How to pass customData via webSDK?

Adding custom data at botInfo inside index.html of webSDK allows developers to pass additional information of the user accessing the channel.

The details like phone number, address or even the access token if in case the webSDK is hosted on the site which needs authorization are examples of data which can be passed inside the customData .

image

customData can be accessed from lastMessage under the BotUserSession of the context object.

This data will be specific to the user using webSDK and will last for his user session.

image

More details on configuring web & mobile SDK has been documented at:

https://developer.kore.ai/docs/bots/kore-web-sdk/kore-ai-web-sdk-tutorial/

4 Likes

Can i pass multiple custom values in customData?

@rajinisiva93 Yes, you could. I have added multiple values to the customData in the index.html file as below:
botOptions.botInfo = {name:"Onconnect check","_id":"st-c7a32a24-9d8f-XXXX-832e-ca817XXXX",customData:{"name":"John","age":30,"cars": {"car1":"Ford","car2":"BMW","car3":"Fiat"}}};

Below is the snapshot of data available in BotUserSession for your reference.

image

2 Likes

How can we perform custom reporting through WebSDK .I have created a API extension in bot builder but don’t know how to proceed forward.Could you elaborate with an example.

Thanks and Regards

Custom Data and Custom reporting seem very different. May be a different topic could be used.
However, please check this out if you are looking for something like this…
https://developer.kore.ai/docs/bots/analyzing-your-bot/custom-dashboard/

Hi,

Is it possible to clear the custom data?

We pass some access token inside the custom data since we don’t want to ask for authentication again when apis are called in service nodes (user is authenticated on login to our app). Since the custom data is included on every response of the bot, it is possible to clear the access token after the connection to Kore.ai is made?