-
- 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 classContactCenterCommunicator.Companion
-
Field Summary
Fields Modifier and Type Field Description private ContactCenterEventsInterfacedelegateprivate IntegercallbackWaitingTimeMSprivate ContactCenterEventsInterfacecallbackprivate final StringbaseURLprivate final StringtenantURLprivate final StringappIDprivate final StringclientID
-
Method Summary
Modifier and Type Method Description UnitcheckAvailability(Function1<Result<ContactCenterServiceAvailability, Error>, Unit> completion)Checks the current status of configured services UnitgetChatHistory(String chatID, Function1<Result<List<ContactCenterEvent>, Error>, Unit> completion)Returns all client events and all server events for the current session. UnitgetCaseHistory(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. UnitrequestChat(String phoneNumber, String from, JSONObject parameters, Function1<Result<ContactCenterChatSessionProperties, Error>, Unit> completion)Request Chat initiates a chat session. UnitsendChatMessage(String chatID, String message, UUID messageID, Function1<Result<String, Error>, Unit> completion)Send a chat message. UnitchatMessageDelivered(String chatID, String messageID, Function1<Result<String, Error>, Unit> completion)Confirms that a chat message has been delivered to the application UnitchatMessageRead(String chatID, String messageID, Function1<Result<String, Error>, Unit> completion)Confirms that a chat message has been read by the user UnitchatTyping(String chatID, Function1<Result<String, Error>, Unit> completion)Informs that a user started to type in a new chat message UnitchatNotTyping(String chatID, Function1<Result<String, Error>, Unit> completion)Informs that a user stopped to type in a new chat message UnitdisconnectChat(String chatID, Function1<Result<String, Error>, Unit> completion)Request to disconnect chat conversation but keep the session active. UnitendChat(String chatID, Function1<Result<String, Error>, Unit> completion)Request to disconnect chat conversation and complete the session. UnitsubscribeForRemoteNotificationsAPNs(String chatID, String deviceToken, Function1<Result<Void, Error>, Unit> completion)Subscribes for push notifications from APNs server This function should be called each time chatIDis changedUnitsubscribeForRemoteNotificationsFirebase(String chatID, String deviceToken, Function1<Result<String, Error>, Unit> completion)Subscribes for push notifications from APNs server when using Firebase service. UnitappDidReceiveMessage(Map<Object, Object> userInfo)Notify contact center library about new remote notification UnitcloseCase(String chatID, Function1<Result<String, Error>, Unit> completion)Closes the CRM case defined by the scenario which handles a current chat session. ContactCenterEventsInterfacegetDelegate()Event' callback final IntegergetCallbackWaitingTimeMS()final ContactCenterEventsInterfacegetCallback()StringgetBaseURL()Base URL to make requests StringgetTenantURL()Identifies your contact center. StringgetAppID()Unique identifier of the Messaging/Chat scenario entry that will be used to associate your application with a specific scenario StringgetClientID()Unique identifier of the client application. UnitsetDelegate(ContactCenterEventsInterface delegate)Event' callback final UnitsetCallbackWaitingTimeMS(Integer callbackWaitingTimeMS)final UnitsetCallback(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 includeschatIDor 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
messageIDwhich is returned in a completion- Parameters:
chatID- : The current chat IDmessage- : Text of the messagecompletion- : ReturnsmessageIDin 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.successor 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.successor 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.successor 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.successor 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.successor 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.successor 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
chatIDis changed- Parameters:
chatID- : The current chat IDdeviceToken- : Unique to both the device and the app.completion- : Returns.successor 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
chatIDis changed- Parameters:
chatID- : The current chat IDdeviceToken- : Unique to both the device and the app.completion- : Returns.successor 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 indidReceiveRemoteNotificationoruserNotificationCenter
-
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.successor 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)
-
-
-
-