Conversation context keys
While a conversation runs, the bot keeps a set of values about it, called the context. You can use them in two places.
- In a message or prompt: insert a value with
${context.<key>}, for example${context.customer.name}. - In a condition: choose Add Condition, pick the Context case and enter the key in Context Path without the
context.prefix, for examplecustomer.email. Then choose Equals or Regex and enter the value to compare with. See Answers.
Context belongs to one customer’s conversation. It is not shared between customers. Use variables for values that are the same for every customer.
About the customer
Section titled “About the customer”Set when the customer sends a message. Which fields exist depends on the channel. A key that does not apply to the channel is empty.
| Key | What it holds | Channels |
|---|---|---|
context.customer.id |
The Amio contact ID of the customer. | All |
context.customer.name |
The customer’s name, when the channel provides one. | Telegram, WhatsApp, email |
context.customer.email |
The email address the customer wrote from. | |
context.customer.phone_number |
The customer’s phone number, digits only, with the country code. | WhatsApp, Facebook Messenger (only if known) |
context.customer.platform_id |
The customer’s WhatsApp ID. | |
context.customer.external_id |
The externalContactId you passed to init on your page. See Install the chat. |
Webchat |
About the customer’s last message
Section titled “About the customer’s last message”Rewritten with every message the customer sends.
| Key | What it holds | Channels |
|---|---|---|
context.customerRequest.text |
The text of the customer’s last message. | All |
context.customerRequest.browserUrl |
The address of the page the customer was on when they wrote. Webchat sends it automatically. You can change it with setBrowserUrl, see Control the chat from your page. It is kept until a newer one arrives. |
Webchat |
context.customerRequest.subject |
The subject of the customer’s last email. | |
context.customerRequest.thread |
The whole email thread, including earlier replies. |
After an AI answer
Section titled “After an AI answer”Set each time an AI answer step runs. See AI agent.
| Key | What it holds |
|---|---|
context.chatgpt.response |
The text the AI wrote, or the error message if the call failed. |
context.chatgpt.httpStatus |
The status code of the AI call, for example 200. |
context.chatgpt.error |
true if the AI call failed, otherwise false. |
context.chatgpt.noData |
true if the answer’s knowledge base was not found and the AI answered without it. |
context.chatgpt.callOperator |
On email bots, yes if the AI decided to hand over to a person, no if it decided to reply. |
After a Make API call step
Section titled “After a Make API call step”Set each time a Make API call step runs.
| Key | What it holds |
|---|---|
context.apiCall.body |
The response body of the call. Use dots to go deeper, for example context.apiCall.body.user.name. For lists, use a position that starts at 0, for example context.apiCall.body.users.0.name. |
context.apiCall.httpStatus |
The status code of the response, or timeout if the call timed out. |
context.apiCall.error |
true if the status code is 400 or higher, or the call timed out. |
After a tool call
Section titled “After a tool call”When the AI calls one of your tools, the result is saved under the tool’s name.
| Key | What it holds |
|---|---|
context.tool.<tool name>.body |
The response body of that tool call. |
context.tool.<tool name>.httpStatus |
The status code of that tool call. |
context.tool.<tool name>.error |
true if the call failed. |
What the customer typed
Section titled “What the customer typed”| Key | What it holds |
|---|---|
context.<name> |
The reply the customer gave in a Wait for customer input step. The name is what you typed in Save input as. If you turn on a validation, such as email, Save input as is filled with the validation’s name, so you read context.email. |
Do not use customer, customerRequest, chatgpt or apiCall as a Save input as name: the bot reserves them and rejects them. Avoid tool too: it is accepted, but it overwrites the results of tools in context.tool.