load
method if you are authorization a user after a conversation has started, or updating the customers info mid conversation with the setCustomer
method.
Read on for details on each of these methods:
on
or off
getState
hide
load
refresh
send
set
setCustomer
setIntent
show
showChatInstead
unload
unloadAndClearSession
on
or off
on
(subscribes) or off
(unsubscribes) keywords to the ASAPP
method. The next argument is the name of the event binding.
The final argument is the callback handler you wish to attach. The following code snippet is an example of the Action API subscribing and unsubscribing to the agent:assigned
and message:received
events:
CustomEvent
object as the first argument to your event handler. This is a standard event object with all typical interfaces. The object has an event.type
with the name of the event and an event.detail
key which contains the following custom properties:
issueId
(Number)
The ASAPP identifier for an individual issue. This ID may change as a user completes and starts new queries to the ASAPP system.
customerId
(Number)
The ASAPP identifier for a customer. This ID is consistent for authenticated users but may be different for anonymous ones. Anonymous users will have a consistent ID for the duration of their session.
externalSenderId
(String)
The external identifier you provide to ASAPP that represents an agent identifier. This property will be undefined if the user is not connected with an agent.
chat:show
chat:hide
issue:new
issue:end
agent:assigned
senderType
(String)
Returns either srs
or agent
.
isLiveChat
(Boolean)
Returns true
when a user is connected with an agent. Returns false
when a user is within an automated flow.
isFirstMessage
(Boolean)
Returns true
only when a message is the first message received from an agent or SRS. Otherwise returns false
.
message:received
hasContext
(Object)
Returns the current context known by the SDK.
hasCustomerId
(Boolean)
Returns true when the SDK has been provided with a CustomerId setting.
isFullscreen
(Boolean)
Returns true when the SDK will render in fullscreen for mobile web devices.
isLiveChat
(Boolean)
Returns true when the use is connected to an agent.
isLoggingIn
(Boolean)
Returns true if the user has been presented with and clicked on a button to Log In.
isMobile
(Boolean)
Returns true when the SDK is rendering on a mobile or tablet device.
isOpen
(Boolean)
Returns true if the user has the SDK open on the current or had it open on the previous page.
unreadMessages
(Integer)
Returns a count of how many messages the user has received since minimizing the SDK.
contextProviderHandler
.
To call the load
the API and initialize the SDK, specify any of the Web App Settings, though the following are required:
ContextProvider
handler to provide context to the SDK such as user authentication information or other customer information.
Load
API.
customerInfo
object at any time, regardless of whether the user is currently typing in the Chat SDK.
Typically, the customerInfo
is updated as part of your contextProviderHandler
function defined in your load
call, which is called whenever the user types in the Chat SDK.
This API is primarily used to send information that is used to show a proactive chat prompt when a specific criteria or set of criteria are met. The send
API is rate limited to one request for every 5 seconds.
To use this API:
type
of customer
customer
event type is supported.data
object containing the customerInfo
object:CustomerInfo
to indicate that a customer had abandoned their shopping cart. Do not use the send API for transmitting any information that you would consider sensitive or Personally Identifiable Information (PII). The accepted keys are listed below.
Code
. Code
accepts a string. Your team and your ASAPP Implementation Manager will determine the available values.
showChatInstead
API and then contact your Implementation Manager.
Options:
Key | Description | Required |
---|---|---|
| Phone number used when a user clicks phone in Chat Instead. | Yes |
Sets the ASAPP APIHostName for connecting customers with customer support. | No (Required if you have not initialized the WebSDK via the | |
Your unique Company Identifier. |
unload
API, this method performs a complete cleanup of all session-related data, making it ideal for logout scenarios where you want to ensure no user data persists.
unloadAndClearSession
as part of your application’s logout process to ensure proper session cleanup and user privacy. After calling this API, you will need to call the load
API again to reinitialize the chat SDK.