InAppMessaging
Interface for in-app messaging functionality.
Interface for in-app messaging functionality.
Syntax: interface InAppMessaging : ConnectModule
Properties
| Properties | Description |
|---|---|
| connectionStatus | Represents the current connection status.val connectionStatus: ConnectionStatus |
| isConnected | Indicates whether there is an active connection.val isConnected: Boolean |
| mediaFileManager | The media file manager for handling media files.val mediaFileManager: MediaFileManager |
| messageStore | The store for in-app messages.var messageStore: MessageStore? |
| messageSynchronizationPolicy | The policy for message synchronization.var messageSynchronizationPolicy: MessageSynchronizationPolicy? |
Functions
| Methods |
|---|
| connect |
| disconnect |
| registerConnectionStatusListener |
| unregisterConnectionStatusListener |
| registerMessagingListener |
| unregisterMessagingListener |
| publishMessage |
| deleteMessage |
| [deleteMessage] |
| fetchBusinessHoursDetail [This method is applicable only for Webex Contact Center or Contact Center-registered assets] |
| fetchMessages |
| publishTypingIndicator (Deprecated) |
| publishTypingIndicator |
| createPostbackMessage |
| createThread |
| updateThread |
| fetchThreads |
| fetchThread |
| fetchUnreadThreadCount |
| sendMessageStatus |
connect()
Initiates a connection.
Syntax: fun connect()
Throws: WebexConnectException If the connection fails.
disconnect()
Disconnects the current session.
Syntax: fun disconnect()
Throws: WebexConnectException: If the disconnection fails.
registerConnectionStatusListener(listener)
Registers a listener for connection status changed events.
Syntax: fun registerConnectionStatusListener(listener: ConnectionStatusListener)
Parameters
| Parameter | Type | Description |
|---|---|---|
| listener | ConnectionStatusListener | The listener to register. |
unregisterConnectionStatusListener(listener)
Unregister a previously registered listener.
Syntax: fun unregisterConnectionStatusListener(listener: ConnectionStatusListener)
Parameters
| Parameters | Type | Description |
|---|---|---|
| listener | ConnectionStatusListener | The listener to unregister. |
registerMessagingListener(listener)
Registers a listener for in-app messaging events.
Syntax:fun registerMessagingListener(listener: InAppMessagingListener)
| Parameter | Type | Description |
|---|---|---|
| listener | InAppMessagingListener | The listener to register. |
unregisterMessagingListener(listener)
Unregister a previously registered listener.
Syntax: fun unregisterMessagingListener(listener: InAppMessagingListener)
Parameters
| Parameter | Type | Description |
|---|---|---|
| listener | InAppMessagingListener | The listener to unregister. |
publishMessage(message, callback)
Publishes a new in-app message.
Syntax: fun publishMessage(message: InAppMessage,callback: PublishMessageCallback)
Parameters
| Parameters | Type | Description |
|---|---|---|
| message | InAppMessage | The message is to be published. |
| callback | PublishMessageCallback | The callback is to be invoked as a result of the publish operation. |
deleteMessage(messageTransactionId, callback)
Deletes a previously sent in-app message.
Support for assets in Webex Contact Center or CCE enabled tenants
This method is not supported for assets in Webex Contact Center or CCE enabled tenants that are registered with Webex Contact Center or CCE.
Syntax: fun deleteMessage(messageTransactionId: String,callback: DeleteMessageCallback)
Parameters
| Parameter | Type | Description |
|---|---|---|
| messageTransactionId | String | The transaction ID of the message is to be deleted. |
| callback | DeleteMessageCallback | The callback is to be invoked as a result of the delete operation. |
deleteMessage(message, callback)
deleteMessage(message, callback)Deletes a previously sent in-app message.
Note
This method is supported for all the assets (Webex Connect, Webex Contact Center, or CCE-enabled tenants) that are registered with Webex Contact Center, or CCE.
Syntax:
fun deleteMessage(message: InAppMessage, callback: DeleteInAppMessageCallback)
Parameters
| Parameter | Type | Description |
|---|---|---|
message | InAppMessage | The message to be deleted. |
callback | DeleteInAppMessageCallback | The callback to be invoked as a result of the delete operation. |
fetchBusinessHoursDetail(callback)
Fetches the full business-hours configuration for the tenant: the weekly schedule and its linked override and holiday lists.
Support for assets in Webex Contact Center or CCE enabled tenants
This method is available only for assets in Webex Contact Center or CCE enabled tenants that are registered with Webex Contact Center or CCE. It is not supported for standalone or unregistered assets.
Syntax:
fun fetchBusinessHoursDetail(callback: BusinessHoursDetailCallback)
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | BusinessHoursDetailCallback | The callback to be invoked as a result of the fetch operation. |
BusinessHoursDetailCallback
BusinessHoursDetailCallbackReference page: https://developers.webexconnect.io/docs/typeaias
| Typealias | Description |
|---|---|
BusinessHoursDetailCallback | Defines a callback for fetching the business hours detail with the result containing the business hours detail and an optional exception if an error occurred. |
fetchMessages(threadId, beforeDate, limit, callback)
Fetches a list of messages from a specific thread.
Syntax:fun fetchMessages(threadId: String, beforeDate: Date?, limit: Int, callback: FetchMessagesCallback)
Parameters
| Parameters | Type | Description |
|---|---|---|
| threadId | String | The ID of the thread from which to fetch messages. |
| beforeDate | Date | The date before which messages should be fetched. |
| limit | Int | The maximum number of messages to fetch. |
| callback | FetchMessagesCallback | The callback is to be invoked with the fetched messages. |
publishTypingIndicator(thread, isTyping)(Deprecated)
Publishes a typing indicator message to the given thread.
Syntax: fun publishTypingIndicator(thread: InAppThread, isTyping: Boolean)
Parameters
| Parameters | Type | Description |
|---|---|---|
| thread | InAppThread | The thread is to publish the typing indicator message. |
| isTyping | Boolean | The flag indicates whether the typing indicator is active or not. |
publishTypingIndicator(thread, isTyping, callback)
Publishes a typing indicator message to the given thread.
Syntax:fun publishTypingIndicator(thread: InAppThread, isTyping: Boolean, callback: PublishTypingIndicatorCallback)
Parameters
| Parameters | Type | Description |
|---|---|---|
| thread | InAppThread | The thread to publish the typing indicator message. |
| typing | Boolean | The flag indicates whether the typing indicator is active or not. |
| callback | PublishTypingIndicatorCallback | The callback to be invoked with the result of the publish operation. |
Sample Code:
val inAppMessaging = InAppMessaging.instance
inAppMessaging.publishTypingIndicator(inAppThread, isTyping = true) { _, _,
exception ->
if (exception != null) {
Log.e(TAG, "Failed to publish typing indicator:
${exception.message}")
} else {
Log.d(TAG, "Typing indicator published successfully.")
}
}
InAppMessaging inAppMessaging = InAppMessaging.getInstance();
inAppMessaging.publishTypingIndicator(inAppThread, true, (inAppThread,
isTyping, exception) -> {
if (exception != null) {
Log.e(TAG, "Failed to publish typing indicator:
${exception.message}");
} else {
Log.d(TAG, "Typing indicator published successfully.");
}
return null;
});
Typing Indicator Throttling Notice
To optimize network usage, the SDK throttles typing indicator events and will send a "typingStart" or "typingStop" event at most once every 5 seconds, even if the publishTypingIndicator() method is called more frequently.
App Developers should account for this behavior and avoid relying on every call resulting in a network event. Instead, use this method as a signal to indicate intent, understanding that the SDK may suppress intermediate events to reduce traffic.
createPostbackMessage(message, button)
Creates a postback message for a button click.
Syntax: fun createPostbackMessage(message: InAppMessage, button: InAppButton): InAppMessage
Return A new instance of [InAppMessage] representing the postback message.
Parameters
| Parameters | Type | Description |
|---|---|---|
| message | InAppMessage | The message to create a postback message. |
| button | InAppButton | The button that was clicked. |
createThread(thread, callback)
Creates a new thread.
Syntax:fun createThread(thread: InAppThread,callback: CreateThreadCallback)
Parameters
| Parameters | Type | Description |
|---|---|---|
| thread | InAppThread | The thread to be created. |
| callback | CreateThreadCallback | The callback is to be invoked as a result of the create operation. |
updateThread(thread, callback)
Updates an existing thread.
Syntax: fun updateThread(thread: InAppThread, callback: UpdateThreadCallback)
| Parameter | Type | Description |
|---|---|---|
| thread | InAppThread | The thread is to be updated. |
| callback | UpdateThreadCallback | The callback is to be invoked as a result of the update operation. |
fetchThreads(beforeDate, limit, callback, category, type)
Fetches a list of threads with optional filtering by category or type.
Syntax: fun fetchThreads(beforeDate: Date, limit: Int, callback: FetchThreadsCallback, category: String? = null, type: InAppThreadType? = null)
Parameters
| Parameters | Type | Description |
|---|---|---|
| beforeDate | date | The date before which threads should be fetched. |
| limit | Int | The maximum number of threads to fetch. |
| callback | FetchThreadsCallback | The callback is to be invoked with the fetched threads. |
| category | string | Optional category to filter the threads by. |
| type | InAppThreadType | Optional type to filter the threads by. |
fetchThread
Fetches the details of a specific thread.
Syntax: fun fetchThread(threadId: String, callback: FetchThreadCallback)
| Parameters | Type | Description |
|---|---|---|
| threadId | String | The ID of the thread to fetch. |
| callback | FetchThreadCallback | The callback is to be invoked with the thread details. |
fetchUnreadThreadCount(callback)
Fetches the count of unread threads.
Syntax: fun fetchUnreadThreadCount( callback: FetchUnreadThreadCountCallback )
Parameters
| Parameters | Type | Description |
|---|---|---|
| callback | FetchUnreadThreadCountCallback | The callback is to be invoked with the count of unread threads. |
sendMessageStatus( messageTransactionIds, status, callback )
Updates the status of one or more messages.
Syntax: abstract fun sendMessageStatus(vararg messageTransactionIds: String, status: InAppMessageStatus, callback: SendMessageStatusCallback? )
| Parameters | Type | Description |
|---|---|---|
| messageTransactionIds | Array | Vararg of message transaction IDs whose status is to be updated. |
| status | InAppMessageStatus | The new status is to be applied to the messages. |
| callback | SendMessageStatusCallback | Optional callback invoked as a result of the status update operation. |
sendMessageStatus(messageTransactionId, status, button, callback)
Updates the status of a message.
Syntax: fun sendMessageStatus(messageTransactionId: String, status: InAppMessageStatus, button: InAppButton? = null, callback: SendMessageStatusCallback? )
Parameters
| Parameters | Type | Description |
|---|---|---|
| messageTransactionId | String | The message transaction ID whose status is to be updated. |
| status | InAppMessageStatus | The new status is to be applied to the message. |
| button | InAppButton | The button that was clicked. |
| callback | SendMessageStatusCallback | Optional callback invoked with the result of the status update operation. |
shutdown
Syntax: fun shutdown()
startup
Syntax: fun startup()
Updated 24 days ago
