Concepts
Conversation context
every conversation in kindly has its own key value store named context that serves as the bot's persisted state for that specific conversation saving values the bot can collect and persist information on the conversation in many ways some are when a pattern dialogue is triggered, what the regexp matches gets saved into the context if the bot sends a webhooks reference docid\ ot0nvuq i76ze m5vrvuc to your server, your response to it can set new context as well by using the widget api docid\ vegid5rt7yj6qjx71w2ly or application api docid\ cgad bxmm1 wvggzsmd1k , you can mutate the context of the conversation by triggering a dialogue that has some context fields attached to it keep in mind that the context memory is a simple key value storage if you insert a key value pair where the key already exists in the memory, the value will be overwritten and the old value will be lost retrieving values when defining bot replies, you may insert placeholders that look like {key} if key is found in the chat context, the value will be inserted if key is not available, the bot will not use that reply, but try to find something else to reply with, or go to a fallback reply the full context is also sent with every webhooks reference docid\ ot0nvuq i76ze m5vrvuc , allowing you to perform any operation you'd like on the context data in your own service examples managing context via application api writing to context when you send data, you can send new context which will be merged with any existing context for the chat (upsert) curl \\ h 'content type application/json' \\ h "authorization your api key" \\ d '{"user id" "unique user id", "message" "hello world!", "new context" {"key" "value"}}' \\ https //bot kindly ai/api/v1/send reading context when you receive a message from the bot, you will also find the context is attached as part of the json payload { "message" "hello world!", "context" { "key" "value" } } managing context via widget api in some cases you might want to add data to the chat context on kindly chat initialization, for instance to know on which page the chat client is loaded or the email of a logged in user you can set chat context when initializing the chat client by populating window\ kindlyoptions context before loading the kindly chat html snippet