Skip to content

Commit

Permalink
Merge pull request #192 from botpress/gui-special-integration-variables2
Browse files Browse the repository at this point in the history
feat: add integration variables
  • Loading branch information
ptrckbp authored Nov 23, 2023
2 parents 1d354f7 + 0be197e commit 17bf22b
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions pages/cloud/studio/variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,17 @@ console.log(data)

Botpress makes available several different variables that can be used in your bot's code. These variables are useful for debugging and for accessing information about the user and conversation.

| Path | Type | Description |
| ------------------------------------------------------------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `event.preview` | Event | The last message sent by the user. It will be replaced every time there is a new message. |
| `conversation.SummaryAgent.summary` | Agent | Summary of the conversation created by the [Summary Agent](./agents/#summary-agent). It's an explanation of what happened. |
| `conversation.SummaryAgent.transcript` | Agent | Transcript of the conversation going back a certain amount of turns. |
| `turn.KnowledgeAgent.answer` | Agent | The answer provided by the [Knowledge Agent](./agents/#knowledge-agent) |
| `turn.KnowledgeAgent.responded` | Agent | Wether the Knowledge Agent has responded automatically to a user question. Its value will be `true` or `false` |
| `turn.KnowledgeAgent?.answer?.length` | Agent | The amount of characters in the Knowledge answer. Use this in an [Expression](../toolbox/transition-to/#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.citations` | Agent | A list of citations for the Knowledge answer. |
| `user.TranslatorAgent.language` | Agent | The current user language code in ISO 639-1 format. [More about the Translator Agent](./agents/#translator-agent) |
| `user.TranslatorAgent.language = 'en'` | Agent | This 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')` | Event | This code snippet returns the raw content that generated the final Knowledge answer. |
| Path | Type | Description |
| ------------------------------------------------------------------------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `event.preview` | Event | The last message sent by the user. It will be replaced every time there is a new message. |
| `conversation.SummaryAgent.summary` | Agent | Summary of the conversation created by the [Summary Agent](./agents/#summary-agent). It's an explanation of what happened. |
| `conversation.SummaryAgent.transcript` | Agent | Transcript of the conversation going back a certain amount of turns. |
| `turn.KnowledgeAgent.answer` | Agent | The answer provided by the [Knowledge Agent](./agents/#knowledge-agent) |
| `turn.KnowledgeAgent.responded` | Agent | Wether the Knowledge Agent has responded automatically to a user question. Its value will be `true` or `false` |
| `turn.KnowledgeAgent?.answer?.length` | Agent | The amount of characters in the Knowledge answer. Use this in an [Expression](../toolbox/transition-to/#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.citations` | Agent | A list of citations for the Knowledge answer. |
| `user.TranslatorAgent.language` | Agent | The current user language code in ISO 639-1 format. [More about the Translator Agent](./agents/#translator-agent) |
| `user.TranslatorAgent.language = 'en'` | Agent | This 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')` | Event | This code snippet returns the raw content that generated the final Knowledge answer. |
| `event.tags.conversation['whatsapp:userPhone']` | Integration | The user's phone number on WhatsApp. Includes the international code. |
| `event.tags.conversation['whatsapp:phoneNumberId']` | Integration | The phone number Id of the bot on WhatsApp. |

1 comment on commit 17bf22b

@vercel
Copy link

@vercel vercel bot commented on 17bf22b Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

documentation – ./

documentation.botpress.sh
documentation-git-master.botpress.sh

Please sign in to comment.