ContactCenterCommunicating
public protocol ContactCenterCommunicating
Provides chat and voice interactions.
This API can be used for development of rich contact applications, such as customer-facing mobile and
web applications for advanced chat, voice, and video communications with Bright Pattern Contact Center-based contact centers.
Sends poll
request to the backend repeatedly for get new chat events. The chat events are received through delegate
-
Chat events delegate. If successful returns an array of chat events ContactCenterEvent for the current session that came from the server or ContactCenterError otherwise
- Tag: DelegateContactCenter
Declaration
Swift
var delegate: ContactCenterEventsDelegating? { get set }
-
Checks the current status of configured services.
- Tag: checkAvailability
Declaration
Swift
func checkAvailability(with completion: @escaping ((Result<ContactCenterServiceAvailability, Error>) -> Void))
Parameters
completion
Current status ContactCenterServiceAvailability of configured services if successful or ContactCenterError otherwise
-
Request Chat initiates a chat session. It provides values of all or some of the expected parameters, and it may also contain the phone number of the mobile device. Note that if the mobile scenario entry is not configured for automatic callback, the agent can still use this number to call the mobile user manually, either upon the agent’s own initiative or when asked to do this via a chat message from the mobile user.
- Tag: requestChat
Declaration
Swift
func requestChat(phoneNumber: String, from: String, parameters: [String : String], with completion: @escaping ((Result<ContactCenterChatSessionProperties, Error>) -> Void))
Parameters
phoneNumber
phone number for callback, if necessary
from
Propagated into scenario variable $(item.from). May be used to specify either the device owner’s name or phone number.
parameters
Additional parameters.
completion
Returns chat session properties that includes
chatID
in ContactCenterChatSessionProperties or ContactCenterError otherwise
-
Returns all client events and all server events for the current session. Multiple event objects can be returned; each event’s timestamp attribute can be used to restore the correct message order.
- Tag: getChatHistory
Declaration
Swift
func getChatHistory(chatID: String, with completion: @escaping ((Result<[ContactCenterEvent], Error>) -> Void))
Parameters
chatID
The current chat ID
completion
Chat client and server events ContactCenterEvent or ContactCenterError otherwise
-
Returns all client events and all server events for all sessions related to the CRM case defined by the scenario which handles a current chat session. For each session, multiple event objects can be returned; each event’s timestamp attribute can be used to restore the correct message order. Can be called after receiving
chatSessionCaseSet
; will returnchatSessionCaseNotSpecified
if server scenario did not specify the case. Note that the case could be specified later during the scenario execution; not necessarily immediately after session start.- Tag: getCaseHistory
Declaration
Swift
func getCaseHistory(chatID: String, with completion: @escaping ((Result<[ContactCenterChatSession], Error>) -> Void))
Parameters
chatID
The current chat ID
completion
Chat sessions with client and server events ContactCenterChatSession or ContactCenterError otherwise
-
Send a chat message. Before message is sent the function generates a
messageID
which is returned in a completion. ThismessageID
should be later used to match thechatSessionMessageDelivered
andchatSessionMessageRead
server events which notify the application that the message has been delivered to or read by an agent.- Tag: sendChatMessage
Declaration
Swift
func sendChatMessage(chatID: String, message: String, with completion: @escaping (Result<String, Error>) -> Void)
Parameters
chatID
The current chat ID
message
Text of the message
completion
Returns
messageID
in the format chatId:messageNumber where messageNumber is ordinal number of the given message in the chat exchange or ContactCenterError otherwise -
Confirms that a chat message has been delivered to the application. This does not necessarily mean that a user had read the message.
- Tag: chatMessageDelivered
Declaration
Swift
func chatMessageDelivered(chatID: String, messageID: String, with completion: @escaping (Result<Void, Error>) -> Void)
Parameters
chatID
The current chat ID
messageID
The message ID from the
chatSessionMessage
eventcompletion
Returns
.success
or ContactCenterError otherwise -
Confirms that a chat message has been read by the user.
- Tag: chatMessageRead
Declaration
Swift
func chatMessageRead(chatID: String, messageID: String, with completion: @escaping (Result<Void, Error>) -> Void)
Parameters
chatID
The current chat ID
messageID
The message ID from the
chatSessionMessage
eventcompletion
Returns
.success
or ContactCenterError otherwise -
Informs that a user started to type in a new chat message.
- Tag: chatTyping
Declaration
Swift
func chatTyping(chatID: String, with completion: @escaping (Result<Void, Error>) -> Void)
Parameters
chatID
The current chat ID
completion
Returns
.success
or ContactCenterError otherwise -
Informs that a user stopped to type in a new chat message.
- Tag: chatNotTyping
Declaration
Swift
func chatNotTyping(chatID: String, with completion: @escaping (Result<Void, Error>) -> Void)
Parameters
chatID
The current chat ID
completion
Returns
.success
or ContactCenterError otherwise -
Closes the CRM case defined by the scenario which handles a current chat session.
- Tag: closeCase
Declaration
Swift
func closeCase(chatID: String, with completion: @escaping ((Result<Void, Error>) -> Void))
Parameters
chatID
The current chat ID
completion
Returns
.success
or ContactCenterError otherwise -
Request to disconnect from a chat conversation but keep the session active. Server may continue communicating with the client.
- Tag: disconnectChat
Declaration
Swift
func disconnectChat(chatID: String, with completion: @escaping (Result<Void, Error>) -> Void)
Parameters
chatID
The current chat ID
completion
Returns
.success
or ContactCenterError otherwise -
Request to disconnect from a chat conversation and complete the session. Server will not continue communicating with the client once request is sent.
- Tag: endChat
Declaration
Swift
func endChat(chatID: String, with completion: @escaping (Result<Void, Error>) -> Void)
Parameters
chatID
The current chat ID
completion
Returns
.success
or ContactCenterError otherwise
-
Subscribes the specified chat session for push notifications from APNs server.
- Tag: subscribeForRemoteNotificationsAPNs
Declaration
Swift
func subscribeForRemoteNotificationsAPNs(chatID: String, deviceToken: String, with completion: @escaping (Result<Void, Error>) -> Void)
Parameters
chatID
The current chat ID
deviceToken
Unique to both the device and the app. Which is received in
didRegisterForRemoteNotificationsWithDeviceToken
completion
Returns
.success
or ContactCenterError otherwise -
Subscribes the specified chat session for push notifications from APNs server when using Firebase service. Firebase gives one more layer of flexibility to have event more granular control of notifications that are sent to the users devices.
- Tag: subscribeForRemoteNotificationsFirebase
Declaration
Swift
func subscribeForRemoteNotificationsFirebase(chatID: String, deviceToken: String, with completion: @escaping (Result<Void, Error>) -> Void)
Parameters
chatID
The current chat ID
deviceToken
Unique to both the device and the app. Which is received in
didReceiveRegistrationToken
completion
Returns
.success
or ContactCenterError otherwise -
Notify contact center library about new remote notification.
- Tag: appDidReceiveMessage
Declaration
Swift
func appDidReceiveMessage(_ userInfo: [AnyHashable : Any])
Parameters
userInfo
Contains a payload with a new event from a backend which is received in
didReceiveRemoteNotification
oruserNotificationCenter