Standard Responses - Can I use context variables in standard response?

(Neha Sheikh) #1

Can I use context variables in standard response?

(Subrahmanyam Donepudi) #2

@nehamsheikh Yes, you can use context variables in the standard responses. Please follow the below syntax:

(Neha Sheikh) #3

Hi @Subrahmanyam ,

We have tried the configuration of the standard response with the ‘UserContext’ and it worked fine.

We want to configure the standard response to show custom context value to the user.
e.g.: if a value is set in’ UserContext’ or ‘context’ then how can we configure the custom value in standard response. For now it showing the custom value set as undefined.

Neha Sheikh

(Subrahmanyam Donepudi) #4

@nehamsheikh, If the channel you use for the bot is web/mobile client, then you can set the customData from the SDK itself by passing it in the botinfo and the same will be available in the BotUserSession data of context. The syntax to retrieve the data at standard response is same as mentioned previously. Please refer to the below posts for more details.

Alternatively, you could even configure the events like Onconnect or Welcome Event available under Apps and Agents to invoke a dialog or run a script at connection of web socket or on first message from the user and then store the needed information into BotUserSession , for instance. This way, the data is available for use and can be accessed from standard responses as well.