-
- All Implemented Interfaces:
-
com.brightpattern.bpcontactcenter.interfaces.ContactCenterCommunicating
public final class ContactCenterCommunicator implements ContactCenterCommunicating
ContactCenterCommunicator is the entry point to use API create an instance of class using static init functions
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
ContactCenterCommunicator.Companion
-
Field Summary
Fields Modifier and Type Field Description private ContactCenterEventsInterface
delegate
private Integer
callbackWaitingTimeMS
private ContactCenterEventsInterface
callback
private final String
baseURL
private final String
tenantURL
private final String
appID
private final String
clientID
-
Method Summary
Modifier and Type Method Description Unit
checkAvailability(Function1<Result<ContactCenterServiceAvailability, Error>, Unit> completion)
Checks the current status of configured services Unit
getChatHistory(String chatID, Function1<Result<List<ContactCenterEvent>, Error>, Unit> completion)
Returns all client events and all server events for the current session. Unit
getCaseHistory(String chatID, Function1<Result<ChatSessionCaseHistoryDto, Error>, Unit> completion)
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. Unit
requestChat(String phoneNumber, String from, JSONObject parameters, Function1<Result<ContactCenterChatSessionProperties, Error>, Unit> completion)
Request Chat initiates a chat session. Unit
sendChatMessage(String chatID, String message, UUID messageID, Function1<Result<String, Error>, Unit> completion)
Send a chat message. Unit
chatMessageDelivered(String chatID, String messageID, Function1<Result<String, Error>, Unit> completion)
Confirms that a chat message has been delivered to the application Unit
chatMessageRead(String chatID, String messageID, Function1<Result<String, Error>, Unit> completion)
Confirms that a chat message has been read by the user Unit
chatTyping(String chatID, Function1<Result<String, Error>, Unit> completion)
Informs that a user started to type in a new chat message Unit
chatNotTyping(String chatID, Function1<Result<String, Error>, Unit> completion)
Informs that a user stopped to type in a new chat message Unit
disconnectChat(String chatID, Function1<Result<String, Error>, Unit> completion)
Request to disconnect chat conversation but keep the session active. Unit
endChat(String chatID, Function1<Result<String, Error>, Unit> completion)
Request to disconnect chat conversation and complete the session. Unit
subscribeForRemoteNotificationsAPNs(String chatID, String deviceToken, Function1<Result<Void, Error>, Unit> completion)
Subscribes for push notifications from APNs server This function should be called each time chatID
is changedUnit
subscribeForRemoteNotificationsFirebase(String chatID, String deviceToken, Function1<Result<String, Error>, Unit> completion)
Subscribes for push notifications from APNs server when using Firebase service. Unit
appDidReceiveMessage(Map<Object, Object> userInfo)
Notify contact center library about new remote notification Unit
closeCase(String chatID, Function1<Result<String, Error>, Unit> completion)
Closes the CRM case defined by the scenario which handles a current chat session. ContactCenterEventsInterface
getDelegate()
Event' callback final Integer
getCallbackWaitingTimeMS()
final ContactCenterEventsInterface
getCallback()
String
getBaseURL()
Base URL to make requests String
getTenantURL()
Identifies your contact center. String
getAppID()
Unique identifier of the Messaging/Chat scenario entry that will be used to associate your application with a specific scenario String
getClientID()
Unique identifier of the client application. Unit
setDelegate(ContactCenterEventsInterface delegate)
Event' callback final Unit
setCallbackWaitingTimeMS(Integer callbackWaitingTimeMS)
final Unit
setCallback(ContactCenterEventsInterface callback)
-
-
Method Detail
-
checkAvailability
Unit checkAvailability(Function1<Result<ContactCenterServiceAvailability, Error>, Unit> completion)
Checks the current status of configured services
- Parameters:
completion
- closure
-
getChatHistory
Unit getChatHistory(String chatID, Function1<Result<List<ContactCenterEvent>, Error>, Unit> completion)
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.
- Parameters:
chatID
- The current chat IDcompletion
- : Chat client and server events or Error otherwise
-
getCaseHistory
Unit getCaseHistory(String chatID, Function1<Result<ChatSessionCaseHistoryDto, Error>, Unit> completion)
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.
- Parameters:
chatID
- The current chat IDcompletion
- : Chat sessions with client and server events or Error otherwise
-
requestChat
Unit requestChat(String phoneNumber, String from, JSONObject parameters, Function1<Result<ContactCenterChatSessionProperties, Error>, Unit> completion)
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.
- Parameters:
phoneNumber
- : phone number for callback, if necessaryfrom
- : Propagated into scenario variable $(item.from).parameters
- : Additional parameters.completion
- : Returns chat session properties that includeschatID
or Error otherwise
-
sendChatMessage
Unit sendChatMessage(String chatID, String message, UUID messageID, Function1<Result<String, Error>, Unit> completion)
Send a chat message. Before message is sent the function generates a
messageID
which is returned in a completion- Parameters:
chatID
- : The current chat IDmessage
- : Text of the messagecompletion
- : ReturnsmessageID
in the format chatId:messageNumber where messageNumber is ordinal number of the given message in the chat exchange or Error otherwise
-
chatMessageDelivered
Unit chatMessageDelivered(String chatID, String messageID, Function1<Result<String, Error>, Unit> completion)
Confirms that a chat message has been delivered to the application
- Parameters:
chatID
- : The current chat IDmessageID
- : The message IDcompletion
- : Returns.success
or Error otherwise
-
chatMessageRead
Unit chatMessageRead(String chatID, String messageID, Function1<Result<String, Error>, Unit> completion)
Confirms that a chat message has been read by the user
- Parameters:
chatID
- : The current chat IDmessageID
- : The message IDcompletion
- : Returns.success
or Error otherwise
-
chatTyping
Unit chatTyping(String chatID, Function1<Result<String, Error>, Unit> completion)
Informs that a user started to type in a new chat message
- Parameters:
chatID
- : The current chat IDcompletion
- : Returns.success
or Error otherwise
-
chatNotTyping
Unit chatNotTyping(String chatID, Function1<Result<String, Error>, Unit> completion)
Informs that a user stopped to type in a new chat message
- Parameters:
chatID
- : The current chat IDcompletion
- : Returns.success
or Error otherwise
-
disconnectChat
Unit disconnectChat(String chatID, Function1<Result<String, Error>, Unit> completion)
Request to disconnect chat conversation but keep the session active. Server may continue communicating with the client
- Parameters:
chatID
- : The current chat IDcompletion
- : Returns.success
or Error otherwise
-
endChat
Unit endChat(String chatID, Function1<Result<String, Error>, Unit> completion)
Request to disconnect chat conversation and complete the session. Server will not continue communicating with the client once request is sent
- Parameters:
chatID
- : The current chat IDcompletion
- : Returns.success
or Error otherwise
-
subscribeForRemoteNotificationsAPNs
Unit subscribeForRemoteNotificationsAPNs(String chatID, String deviceToken, Function1<Result<Void, Error>, Unit> completion)
Subscribes for push notifications from APNs server This function should be called each time
chatID
is changed- Parameters:
chatID
- : The current chat IDdeviceToken
- : Unique to both the device and the app.completion
- : Returns.success
or Error otherwise
-
subscribeForRemoteNotificationsFirebase
Unit subscribeForRemoteNotificationsFirebase(String chatID, String deviceToken, Function1<Result<String, Error>, Unit> completion)
Subscribes 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.
This function should be called each time
chatID
is changed- Parameters:
chatID
- : The current chat IDdeviceToken
- : Unique to both the device and the app.completion
- : Returns.success
or x-source-tag://ContactCenterError otherwise
-
appDidReceiveMessage
Unit appDidReceiveMessage(Map<Object, Object> userInfo)
Notify contact center library about new remote notification
- Parameters:
userInfo
- : Contains a payload with a new event from a backend which is received indidReceiveRemoteNotification
oruserNotificationCenter
-
closeCase
Unit closeCase(String chatID, Function1<Result<String, Error>, Unit> completion)
Closes the CRM case defined by the scenario which handles a current chat session.
- Parameters:
chatID
- : The current chat IDcompletion
- : Returns.success
or x-source-tag://ContactCenterError otherwise
-
getDelegate
ContactCenterEventsInterface getDelegate()
Event' callback
-
getCallbackWaitingTimeMS
final Integer getCallbackWaitingTimeMS()
-
getCallback
final ContactCenterEventsInterface getCallback()
-
getBaseURL
String getBaseURL()
Base URL to make requests
-
getTenantURL
String getTenantURL()
Identifies your contact center. It corresponds to the domain name of your contact center that you see in the upper right corner of the Contact Center Administrator application after login.
-
getAppID
String getAppID()
Unique identifier of the Messaging/Chat scenario entry that will be used to associate your application with a specific scenario
-
getClientID
String getClientID()
Unique identifier of the client application. It is used to identify communication sessions of a particular instance of the mobile application (i.e., of a specific mobile device). It must be generated by the mobile application in the UUID format. If clientId is set to WebChat, HTTP cookies will be used for client identification.
-
setDelegate
Unit setDelegate(ContactCenterEventsInterface delegate)
Event' callback
-
setCallbackWaitingTimeMS
final Unit setCallbackWaitingTimeMS(Integer callbackWaitingTimeMS)
-
setCallback
final Unit setCallback(ContactCenterEventsInterface callback)
-
-
-
-