Botpress provides several built-in variables that contain useful information about the current state of your bot. You don’t need to create these variables yourself — you can just read them whenever you need them.

Here’s a list of all the built-in variables in Botpress:

PathTypeDescription
event.previewEventThe last message sent by the user. It will be replaced every time there is a new message.
conversation.SummaryAgent.summaryAgentSummary of the conversation created by the Summary Agent. It’s an explanation of what happened.
conversation.SummaryAgent.transcriptAgentTranscript of the conversation going back a certain amount of turns.
turn.KnowledgeAgent.answerAgentThe answer provided by the Knowledge Agent
turn.KnowledgeAgent.respondedAgentWether the Knowledge Agent has responded automatically to a user question. Its value will be true or false
turn.KnowledgeAgent?.answer?.lengthAgentThe amount of characters in the Knowledge answer. Use this in an Expression to check if there is an answer in the KB. Optionally add ! to start of the code in order to check if there was NOT an answer.
turn.KnowledgeAgent.citationsAgentA list of citations for the Knowledge answer.
user.TranslatorAgent.languageAgentThe current user language code in ISO 639-1 format. More about the Translator Agent
user.TranslatorAgent.language = 'en'AgentThis code snippet set’s the user language to English. Replace with any language code in the ISO 639-1 format
event.kb.results.map((a) => a.dsFriendlyName + '\n' + a.content).join('\n\n')EventThis code snippet returns the raw content that generated the final Knowledge answer.
event.tags.conversation['whatsapp:userPhone']IntegrationThe user’s phone number on WhatsApp. Includes the international code.
event.tags.conversation['whatsapp:phoneNumberId']IntegrationThe phone number Id of the bot on WhatsApp.