InAppAutomationManager

InAppAutomationManager

Interface for controlling the behavior of In-App Automations.

Methods

isPaused() → {Promise.<boolean>}

Retrieves the current value of the pause state

Returns:
Type:
Promise.<boolean>
Example
const paused = await sdk.components.inAppAutomation.isPaused()
if (paused) {
  // messages display is paused
}

setDisplayDelegate(delegate) → {Promise.<void>}

Sets an optional display delegate which can control and be notified of in-app lifecycle events.

Note: When using a display delegate, it is recommended that you start the In-App Automation engine in "paused" mode by setting components.inAppAutomation.startInPausedState to true, and then calling setPaused(false) after you have attached your delegate. If you do not, you may miss some displays as the engine will begin processing before you have attached your delegate.

Parameters:
Name Type Description
delegate InAppDisplayDelegate

the display delegate

Returns:
Type:
Promise.<void>
Example
const delegate = {
  isMessageReadyToDisplay: (message) => {
     if (myApp.canDisplayMessage(message)) {
       return true
     }
     return false
  }
}
await sdk.components.inAppAutomation.setDisplayDelegate(delegate)
await sdk.components.inAppAutomation.setPaused(false)

setPaused(paused) → {Promise.<void>}

Pauses or resumes the display of in-app messaging.

This does not prevent messages from being triggered, it only pauses the display from occurring. At a later date when you unpause display, any queued messages will display as expected.

Parameters:
Name Type Description
paused

value to which the pause state should be set

Returns:
Type:
Promise.<void>
Example
// pause display of in-app experiences
await sdk.components.inAppAutomation.setPaused(true)
// resume display of in-app experiences
await sdk.components.inAppAutomation.setPaused(false)