ContextProvider
is used for passing various information about your users or their sessions to the Chat SDK. It is a key that may be set in the Load and SetCustomer APIs. The key must be assigned a function that will receive two arguments.
The first argument is a callback
function. The second argument is a needsRefresh
boolean indicating whether or not the authorization information needs to be refreshed.
The ContextProvider
is called whenever the user types in the Chat SDK.
callback
argument with your context object as the sole argument. This will pass your context object to the ASAPP Chat SDK.
needsRefresh
argument returns a boolean value indicating whether or not your user’s authorization has expired.
ContextProvider
plays an important role in authorizing your users with the ASAPP Chat SDK. Whether your users are always authenticated or transitioning from an anonymous to integrated use case, you must use the ContextProvider’s Auth
key to provide a user’s authorization.
Auth
key and the following set of nested properties:
Auth
object is optional, but you must provide any necessary information for your authenticated users.
Body
, Cookies
, and Headers
keys all accept an object containing any number of key:value pairs.Scopes
key accepts an array of strings defining which services may be updated with the provided token.Token
key accepts a single access token string.ContextProvider
for authenticating your users.
CustomerInfo
key. The key is a child of the context object and contains a series of key:value pairs.
Your page is responsible for defining and setting the keys you would like to track. You may define and pass along as many keys as you would like.
You must discuss and agree upon the attribute names with your Implementation Manager.
CustomerInfo:
CustomerInfo
Object
CustomerInfo
, custom_params
, or customer_params
. For more information, click here.CustomerInfo
key being used to pass along analytics data.
ContextProvider
may be used for passing existing session information along to the Chat SDK. This is for connecting a user’s page session with their SDK session.
You may provide two keys---ExternalSessionId
and ExternalSessionType
---for connecting session information. The value of each key is at your discretion.
A user does not need to be authenticated in order to provide session information.
ExternalSessionId
String
'j6oAOxCWZh...'
Your user’s unique session identifier. This information can be used for joining your session IDs with ASAPP’s session IDs.ExternalSessionType
String
'visitID'
ExternalSessionId
.
ContextProvider
to pass the entity information along to the Chat SDK.
To do so, provide the optional CompanySubdivision
key with a value of your subdivision’s identifier. The identifier value will be determined in coordination with your ASAPP Implementation Manager.
CompanySubdivision
Object
'divisionId'
Segments
key to apply labels to your reports.
Each key you provide allows you to filter your reporting dashboard by those values.
Segments
Array
'north america'
, 'usa',``'northeast'
]