SDK

In-App Messages

In this page you'll learn how in-app messages can be added to your app and what are all the options at your disposal to create a great messaging experience for your users.

These services will bring a new level of contextuality to your app, allowing you to create in-app messages or categorize users based on their interaction behaviour.

As mentioned in the Implementation page, if you are going to use in-app messaging, you must include the NotificareInAppMessagingKit dependency.

Since this is a zero-configuration feature library, you don't have to implement or configure anything other than including the dependency to get started.

The in-app messaging library is only available from version 3.4.0 and up.

Suppressing messages

During certain flows, like during a purchase, it can become convenient to suppress in-app messages from being shown to the user, interrupting their engagement.

You can, optionally, suppress messages by setting a flag. It's important to reset the flag once the priority flow is complete, otherwise the library will continue suppressing the messages until the application is restarted.

Notificare.shared.inAppMessaging().hasMessagesSuppressed = true

By default, the SDK doesn't re-evaluate the foreground context when you stop suppressing in-app messages. In case you want to trigger a new context evaluation after you stop suppressing in-app messages, you can use the following method instead.

Notificare.shared.inAppMessaging().setMessagesSuppressed(false, evaluateContext: true)

Messages lifecycle

You can perform additional actions when certain events occur while handling in-app messages. To do so, set yourself as the delegate:

class ViewController: UIViewController, NotificareInAppMessagingDelegate {
    override func viewDidLoad() {
        // more code ...

        Notificare.shared.inAppMessaging().delegate = self
    }

    func notificare(_ notificare: NotificareInAppMessaging, didPresentMessage message: NotificareInAppMessage) {

    }

    func notificare(_ notificare: NotificareInAppMessaging, didFinishPresentingMessage message: NotificareInAppMessage) {

    }

    func notificare(_ notificare: NotificareInAppMessaging, didFailToPresentMessage message: NotificareInAppMessage) {

    }

    func notificare(_ notificare: NotificareInAppMessaging, didExecuteAction action: NotificareInAppMessage.Action, for message: NotificareInAppMessage) {

    }

    func notificare(_ notificare: NotificareInAppMessaging, didFailToExecuteAction action: NotificareInAppMessage.Action, for message: NotificareInAppMessage, error: Error?) {

    }
}