BotContext - Does it get cleared with end of user session?


(Neha Sheikh) #1

I have added some data to my botcontext.
Will it get removed/cleared from bot if any of bot user session expires?


(swathi vadlamani) #2

@nehamsheikh Data saved in bot doesn’t get deleted, even post user session expires.


(Subrahmanyam Donepudi) #3

Hi @nehamsheikh

The TTL for variables being created under any of the context types can be defined using the below syntax:

BotContext.put("", “Value”, TTL)

*TTL (time to last in mins)

Please refer to the below link for more details:

https://developer.kore.ai/docs/bots/bot-builder/defining-bot-tasks/using-session-and-context-variables-in-tasks/

If the TTL is not specified while creating variables, they last forever under the respective context types except for UserSession and BotUserSession. For these two context types, if the TTL is not provided for variables, the default time to last is 30 mins.


(Shyam Kumar) #4

Can anyone elaborate how to PUT,POST and DELETE BotContext data


(Subrahmanyam Donepudi) #5

Could you please elaborate on this? Are you looking for options to modify the data present under bot context or you actually want to utilize the data for passing over to your backend systems?


(Shyam Kumar) #6

Yes, i am looking for the options to modify data present in bot context.
FYI https://developer.kore.ai/docs/bots/bot-builder-tool/dialog-task/context-object/


(Swagat) #7

As described in the link you mentioned you can use the same syntax commands in script nodes or in botkit to modify context objects.
Please go through the below also.
https://developer.kore.ai/docs/bots/bot-builder-tool/dialog-task/working-with-the-script-node/