Using context in your chatbot

Context keys allow you to collect, use and store information from a user's interaction with your chatbot. This information can then be used to identify a user, personalize an interaction, look up some information or trigger another action.

Context key examples

Some examples of the type of information you may be interested in collecting and using:

  • Information submitted by a user in a chat form - eg name, contact details, reference number
  • User name and other data from a logged-in environment - context from the page the bot is hosted on

How to set up context keys

To set a new context key, go to Configuration > Bot context. (Can't see Bot context on your menu? Contact us to enable).


The name of your context key should match any other uses of that context within the bot/portal. For example, if you are matching a reference number, the context key could be named Reference, corresponding to a form field also named Reference.


There are three options for the scope of the context key:

  • Message - persists for that message only and then is 'forgotten' by the bot
  • Conversation - persists for the conversation before being 'forgotten' by the bot. A conversation is a series of messages that may last up to a number of hours, but not over multiple days.
  • User - is forever attached to that user - typically this would be used for a name, for example.


Sensitive data can be stored and masked. Highly sensitive data is only accessible by the bot and not stored at all

Owned by

Data contained in the context key can be viewed and modified by the owner. This can be set to the user or the system.

For example, if you have already collected a user's name from a previous conversation, rather than be asked again, the user will have the option to change it:

How to collect context from the page

You can use our API to collect context from the page a bot is hosted on. Detailed information.

How to collect context from a chat form

To collect (and store, if required) context from a user-submitted chat form, make sure that you have a context key set up and named to match the relevant field in the form.

Learn more about chat forms

Examples of context in use

Enhanced support

Helpfruit is used as a support bot for sign in and safety solution EVA Check-in. If a logged-in user asks a question of the EVA chatbot, information about that user is collected from the page (eg their name and company ID) and can then be used to provide enhanced and personalized support.

Triggering an API form

A freight company combines pattern matching with context to look up the status of a shipment when a user enters a tracking number into chat.

Providing information to customer support advisors

Other customers collect information while a user is waiting for live chat to connect. The information collected becomes context that can be used by the live chat agent to personalize and better answer the user's questions.