> For the complete documentation index, see [llms.txt](https://docs.luciq.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.luciq.ai/ios/setup-luciq-for-ios/setup-in-app-replies/managing-notifications.md).

# Managing Notifications

Detailed in this page is how you can set up push notifications as well as manage in-app notifications for new in-app chat messages for your iOS apps.

## Push Notifications

You can enable Luciq to send your users push notifications each time you send them a new message.

### Uploading Your Push Certificate

Follow the steps below to upload your push certificate to your Luciq dashboard.

1. Follow [this tutorial to generate a push certificate and export it to a `.pem` file](https://www.luciq.ai/blog/how-to-generate-a-push-certificate-and-export-it-to-a-pem-file/).
2. Go to the **Push Notifications** page on your Luciq dashboard and upload your `.pem` file.
3. Select whether the certificate you're uploading is for development or production, and enter the pass phrase if you set one.

### Handling Luciq Notifications

In `application:didRegisterForRemoteNotificationsWithDeviceToken:`, pass the token you get to Luciq.

{% tabs %}
{% tab title="Swift" %}
{% code overflow="wrap" %}

```swift
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    Replies.didRegisterForRemoteNotifications(withDeviceToken: deviceToken)
}
```

{% endcode %}
{% endtab %}

{% tab title="Objective-C" %}
{% code overflow="wrap" %}

```objectivec
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    [LCQReplies didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

When you receive a notification, check if it's a Luciq notification, then pass it to Luciq if necessary.

{% tabs %}
{% tab title="Swift" %}
{% code overflow="wrap" %}

```swift
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
    let isLuciqNotification = Replies.didReceiveRemoteNotification(userInfo)
}
```

{% endcode %}
{% endtab %}

{% tab title="Objective-C" %}
{% code overflow="wrap" %}

```objectivec
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
    BOOL isLuciqNotification = [LCQReplies didReceiveRemoteNotification:userInfo];
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

And finally, handle when your application has been launched from a Luciq notification. Add the following to `application:didFinishLaunchingWithOptions:`.

{% tabs %}
{% tab title="Swift" %}
{% code overflow="wrap" %}

```swift
if let notification = launchOptions?[.remoteNotification] as? [String: AnyObject] {
    let isLuciqNotification = Replies.didReceiveRemoteNotification(notification)
}
```

{% endcode %}
{% endtab %}

{% tab title="Objective-C" %}
{% code overflow="wrap" %}

```objectivec
NSDictionary *notificationDictionary = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];

BOOL isLuciqNotification = [LCQReplies didReceiveRemoteNotification:notificationDictionary];
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Disabling Push Notifications

Push notifications are enabled by default if you upload a push certificate to your Luciq dashboard. To disable them, use the following method.

{% tabs %}
{% tab title="Swift" %}
{% code overflow="wrap" %}

```swift
Replies.pushNotificationsEnabled = false
```

{% endcode %}
{% endtab %}

{% tab title="Objective-C" %}
{% code overflow="wrap" %}

```objectivec
[LCQReplies setPushNotificationsEnabled:NO];
```

{% endcode %}
{% endtab %}
{% endtabs %}

## In-App Notifications

By default, a notification will be shown on top of your app's UI when a new message is received.

{% hint style="info" %}

#### Email Notifications

If your user doesn't view the new message within 10 minutes, they will be sent an email notification as well.
{% endhint %}

### Disabling In-App Notifications

Use the following method to disable notifications that appear in-app.

{% tabs %}
{% tab title="Swift" %}
{% code overflow="wrap" %}

```swift
Replies.inAppNotificationsEnabled = false
```

{% endcode %}
{% endtab %}

{% tab title="Objective-C" %}
{% code overflow="wrap" %}

```objectivec
LCQReplies.inAppNotificationsEnabled = NO;
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Getting Unread Messages Count

You can use the following method to get the number of messages a user has yet to read.

{% tabs %}
{% tab title="Swift" %}
{% code overflow="wrap" %}

```swift
let messageCount = Replies.unreadRepliesCount
```

{% endcode %}
{% endtab %}

{% tab title="Objective-C" %}
{% code overflow="wrap" %}

```objectivec
NSUInteger messageCount = LCQReplies.unreadRepliesCount;
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.luciq.ai/ios/setup-luciq-for-ios/setup-in-app-replies/managing-notifications.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
