Skip to main content

acceptGreeting

You can use this method to inform that a customer has seen a greeting. Based on that, the Reports section displays only the greetings seen by Customers instead of all the sent greetings. If a customer started a chat from a greeting but you didn’t execute acceptGreeting method, the greeting counts as seen in Reports anyway. As arguments to this method you should use uniqueId & greetingId received in the incoming_greeting or connected event.
Parameters:

Errors

  • GREETING_NOT_FOUND - a given uniqueId couldn’t be found on the server

cancelGreeting

Cancels a greeting (an invitation to the chat). For example, Customers could cancel greetings by clicking close icon on the displayed greeting.
Parameters:

Errors

  • GREETING_NOT_FOUND - given uniqueId could not be found on the server

cancelRate

Cancels rate-related thread properties.

Errors

  • MISSING_CHAT_THREAD - the targeted chat is empty and has no threads.

connect

Starts the connection process to our servers. It is needed when:
  • The autoConnect: false argument has been passed to the init method.
  • You get disconnected for a reason that suspends reconnection attempts (e.g. inactivity_timeout).

deactivateChat

Parameters: Returned value:

deleteChatProperties

Deletes given chat properties.
Parameters: Returned value:

deleteEventProperties

Deletes given event properties.
Parameters: Returned value:

deleteThreadProperties

Deletes given chat thread properties.
Parameters: Returned value:

destroy

Clears any stored resources, removes all listeners, and disconnects from the network. After using this method, you won’t be able to use the destroyed Customer SDK instance.

disconnect

Disconnects from the server.

getChat

Returns the chat data about the requested chat ID together with a single thread’s data. If the method is called with the threadId parameter, then this particular thread is being returned. If no threadId is given, the latest thread is automatically returned.
Parameters: Returned value:

getChatHistory

Helps loading in historical thread events. First, call getChatHistory to access the history object of a particular chat. The returned history object has only one method, next, which gives you a Promise with a { done, value } object.
  • done - indicates if there is anything more to load
  • value - an object with an array of threads, each containing an array of its events
Then, you can keep calling history.next() multiple times to load previous historical events. They’re going to be grouped into threads and might require merging with already loaded events. This is useful for implementing an infinite scroll or otherwise showing your customer’s archival chats. Keep in mind, though, that you generally shouldn’t call next while the history is loading - we queue those requests, so the previous one must resolve before we proceed with the next one. The structure such as our history object is called an async iterator.
Parameters:

getCustomer

Returns the info about the customer requesting it.
Returned value:

getForm

Allows you to fetch a form template for a given group and form type.
Parameters: Returned value:

getUrlInfo

It returns the info on a given URL.
Parameters: Returned value:

off

Unsubscribes from emitted events, which are described here.

on

Subscribes to emitted events, which are described here.

once

Subscribes to emitted events, which are described here. Unsubscribes immediately after the callback gets called.

listChats

It returns summaries of the chats a customer participated in.
Parameters: Returned value:

listGroupStatuses

Returns availability statuses of the requested groups.
Parameters: Returned value:

listThreads

Returns a list of thread objects together with the previous and next page ID cursors that can be used to load more threads. If you want to load consecutive events, consider using getChatHistory.
Parameters: Returned value:

markEventsAsSeen

Marks events as seen by the current customer up to the given date.
Parameters: Returned value:

rateChat

Sends chat rating and a comment for the most recent chat thread.
Parameters: Returned value:

Errors

  • MISSING_CHAT_THREAD - the targeted chat cannot be rated because it has no threads.

requestWelcomeMessage

Requests a welcome message for the current customer. The welcome message is returned via the incoming_welcome_message event.
Parameters: Returned value:

Errors

  • GROUP_OFFLINE - the requested group is offline, and it was not possible to return a predicted agent for it.
  • GROUP_UNAVAILABLE - thrown when manual routing is enabled for the group and a predicted agent is requested for it. If you call startChat or resumeChat accordingly, you’ll end up in the queue.

sendGreetingButtonClicked

Sends information to the server about a customer clicking a greeting button. Use this when a greeting includes a button with a buttonId property.
Parameters:

resumeChat

Resumes an archived chat.
Parameters:

Errors

  • CHAT_ALREADY_ACTIVE - the chat is already active and you can’t activate it again.
  • GROUPS_OFFLINE - a group in the targeted chat is offline. It can happen for licenses without continuous chats enabled.

sendEvent

Sends a provided object as an event with a specified type.
Parameters:

sendRichMessagePostback

Sends information to the server about a user’s interaction with a rich message button.
Parameters:

setCustomerSessionFields

Sends the request to set customer’s session fields. They are available for the duration of the session.
Parameters:

setSneakPeek

You can use it to update the sneak peek in the Agent App. It is sent to the server only if the target chat is active. This method doesn’t return a promise.
Parameters:

startChat

Starts a new chat. For one customer, you can only start one chat. In order to activate a previously started chat, use resumeChat.
Parameters:

Errors

  • CHAT_LIMIT_REACHED - the maximum limit of chats per customer has been reached, and it’s not possible to start a new one. You should activate one of the existing chats. The limit is 1.
  • GROUPS_OFFLINE - a group in the target chat is offline. It can happen for licenses, which don’t allow Customers to chat during their unavailability.

updateChatProperties

Parameters:

updateCustomer

Updates the specified customer properties and fields.
Parameters:

Errors

  • CUSTOMER_SESSION_FIELDS_LIMIT_REACHED - total amount of session fields would have been exceeded after requested update

updateCustomerPage

Updates information about the customer page using the provided page object.
Parameters:

updateEventProperties

Updates given properties of an event.
Parameters:

updateThreadProperties

Parameters:

uploadFile

Returns both a promise and a cancel. You can use cancel to abort a file upload. It also lets you pass the onProgress callback function. Keep in mind that the maximum accepted file size is 10 MB. It returns a URL that expires after 24 hours unless the URL is used in sendEvent
Parameters: onProgress parameters: Returned value: In React Native, instead of passing a blob you need to pass an object of such a shape: