Configure asynchronous engagement and push messaging
Nuance Messaging platform utilizes the push messaging functionality provided by the Google Firebase iOS SDK to facilitate asynchronous (also referred to as "async") communications. Push messages are used to continue an asynchronous messaging conversation between an agent and a customer, where the two parties are not simultaneously connected and communication is intermittent.
Overview of asynchronous engagement
To turn on or continue async conversations, your application must set the isAsyncEngagement property in the engageParameters class to true.
In Nuance Messaging UI Framework, by default, when the SDK retrieves a transcript, it only receives the transcript from the last conversation from the server. To display all of the transcripts from all previous conversations, your application must set asyncMode property in the engageParameters class to all.
Persistent customer ID
In order for a customer to continue an async conversation across different channels, your application must provide the SDK with a persistent customer ID. The same ID (key and value) must be used across different channels to continue the conversation in those channels.
The function below lets you set a persistent customer ID, which must be set before a customer starts a conversation.
ProfileManager.getInstance().addUniqueCustomerID("email", andValue: "test@aaa.com")
- Key:Pass the method persistent customer ID type
- Value:Pass the method persistent customer ID for the given user
Push notifications
To enable push messages, your application should pass the device registration token using the SDK's Initialize method. However, there is an alternative, detailed below.
The function below lets you pass fcmToken outside of SDK Initialize method. FCM Token must be provide before user starts an engagement.
- (void)setFCMToken:(NSString *)fcmToken
Various notification scenarios
The following scenarios help explain when Nuance async platform sends push notifications:
The customer closes the messaging window In an async engagement, the agent can still send new messages even after the customer closes the messaging window. These messages are delivered as a push message.
Followup conversation When an agent marks the current on going conversation as a Follow-up, the agent can retrieve a follow up conversation from HTML AI dashboard and send a follow up message to the customer. This message is sent to the app as a push message.
Messaging session timeoutIf a customer puts the app to the background during an ongoing conversation, Nuance Platform detects it as a lost connection. Nuance Platform waits until the timeout expires before it sends those messages as push messages.
Application handling Nuance push messages
Firebase notifications behave differently, depending on the foreground/background state of the receiving app. Refer to the Google Firebase guidelines for more information on how to handle push messages.
Upon receiveing a push message, your applicaiton should parse the data associated with the push message. Data sent along with the push message are agentGroupID, businessUnitID, and businessRuleId.
While constructing engageParameters for launchMessagingViewController, your application must override agentGroupID, businessUnitID, and businessRuleId with the values provided in the push message.
Async confiuration properties
Use the following properties in the MessagingViewProperties class to control the SDK's async capabilities.
Name | Type | Default value | Description |
---|---|---|---|
showAsyncAgentExit | bool | false | Sets whether an agent closed engagement message should be displayed. |
showAsyncAgentResoved | bool | true | Sets whether an agent resolved conversation message should be displayed. |
showAsyncHeader | bool | false | Sets the visibility of the async conversation header. |
Use the following properties in the CustomerInformationMessages class to set various information messages.
Name | Type | Default value | Description |
---|---|---|---|
agentLeftConversation | string | This property overrides the default agent closed engagement message. | |
agentResolvedConversation | string | This property overrides the default agent resolved engagement message. |
Use the following properties in the MessagingViewProperties class to style Async conversation UI.
Name | Type | Default value | Description |
---|---|---|---|
asyncHeaderBorderColor | UIColor | UIColor.black | Sets the header border color. |
asyncHeaderBackgroundColor | UIColor | UIColor.green | Sets the header background color. |
asyncHeaderBackgroundColor | UIColor | UIColor.green | Sets the header background color. |
asyncHeaderBorderWidth | Int | 0 | Sets the header border width. |
asyncHeaderCornerRadius | Int | 0 | Sets the header corder radius. |
asyncHeaderLeftMargin | Int | 2 | Sets the header left margin. |
asyncHeaderRigthMargin | Int | 2 | Sets the header right margin. |
asyncHeaderTopMargin | Int | 4 | Sets the header top margin. |
asyncHeaderBottomMargin | Int | 5 | Sets the header bottom margin. |
asyncHeaderHeight | Int | 15 | Sets the header height. |
asyncHeaderTextFontStyle | UIFont | UIFont(name: "Helvetica", size: 11.0)! | Sets the header font style. |
displayQueuedMessagesInAsync | booleam | true | Configures the display of queued message when the engagement is async. |
Agent message when minimized
Push notifications are not used when the customer has minimized the messaging window during an on-going conversation and the application is in the forground. Please refer to the section Handling Minimized State in the Nuance Messaging UI Framework.
Note: When the customer puts the application to the background while the chat is minimized, the Messaging Session timeout push notification scenario begins.