Pass available visitor info to the chat
33
November 29, 2022
You can pass any information about a visitor to the chat using our JavaScript API.
Example:
window.chaportConfig = {
appId: '' ,
visitor: {
name: 'John Doe',
email: '[email protected]',
custom: {
subscriptionPlan: 'pro',
balance: 1000,
},
}
}
You can pass only the fields that are specified in the corresponding JavaScript API table or created by you (see the Custom fields article).
The list of available fields is located in Settings → Visitor Info.
To find the API key of a field, you should click on the i
icon next to the field name.
All API keys of custom fields have the following format: custom.fieldName
. When passing a custom field through the API, you must put it in the “custom” block as in the above example. The field name should not contain custom.
.
Please note: Javascript API and custom fields are only available on our paid plans.