Parameters, access and response of an API action
Choose who provides each value of a call, which visitors can use it and what the assistant reads from the response.
- Plans
- All plans
- Roles
- Owner, Admin
- In the admin
- Chatbot › Actions › Custom API actions
An API action is only as safe as its parameters. For each value, you say who provides it: the assistant, the visitor themselves, or Botello. You also say which visitors can use the action, and which fields of the response the assistant may read. These three settings stop a visitor from reading another customer’s data, and stop a booby-trapped response from manipulating the assistant.
An action that touches a customer’s orders, appointments or data: the right source and access settings make the difference between “handy” and “data leak”.
Before you start
- You know how to create an action: see Create an API action.
- For verified values (
verified_email,verified_phone,verified_customer_id), your site must pass the customer’s identity: see Verified visitors.
Declare a parameter
Every {{name}} used in the URL, a non-secret header or the JSON body must be declared under Parameters the AI fills in.
Prop
Type
Who provides the value
| Source (admin label) | Technical value | How it is filled in | For what |
|---|---|---|---|
| The assistant (it chooses the value) | ai | The assistant infers it from the conversation. | A date, a size, a quantity, a SKU taken from the catalog. |
| The visitor (they must have written it) | visitor | The assistant proposes it, but Botello refuses it if the visitor did not write it themselves in this conversation. | An order number, an e-mail typed by the visitor, a name. |
| Botello (safe value, hidden from the AI) | context | Botello inserts it itself at call time. The AI does not see this parameter and cannot change it. | The customer’s verified identity, the conversation ID. |
Rules for a “The visitor” value
Botello compares the value with the visitor’s messages, ignoring case, spaces and punctuation:
- a one-word value must be a whole word written by the visitor:
1001is found in “order no. 1001,”, but not in “10012”; - a multi-word value must appear in that order, as one block, in a single message;
- a value shorter than 3 characters is always refused: it cannot be told apart from chance.
If the value is refused, nothing is called: the assistant asks the visitor for the value. A value can therefore come neither from a web page, nor from another action, nor from the model’s imagination.
Values provided by Botello
| Value | Key | Content |
|---|---|---|
| Conversation id | conversation_id | Botello’s ID for the conversation |
| Session id | session_id | The visitor’s session ID |
| Reply language | language | The language the assistant answers in, for example fr |
| Channel (web, WhatsApp…) | channel | web, whatsapp… |
| Page visited | page_url | The path of the page the visitor is on, without domain or query parameters, for example /produits/montre-classic. Empty if the widget did not send it |
| Customer's verified e-mail | verified_email | The e-mail guaranteed by your site (identity token) |
| Customer's verified phone | verified_phone | The phone number guaranteed by your site, or by WhatsApp |
| Verified customer id | verified_customer_id | The sub of your site’s identity token |
If a required parameter provided by Botello has no value (for example verified_email for a visitor who has not given a verified e-mail), the action is not available to that visitor and nothing is called.
Who can use the action
| Setting | Technical value | Effect |
|---|---|---|
| Verified visitors only unticked | public | The action is offered to every visitor. |
| Ticked | verified | The action is offered to the assistant only if the visitor is verified: valid identity token on the site, or number guaranteed by WhatsApp. For everyone else, it does not exist. |
Two rules are enforced on save:
- an action that uses a
verified_…value is necessarily reserved for verified visitors (the admin ticks the box for you); - an action reserved for verified visitors must use at least one
verified_…value. Otherwise, any signed-in customer could request someone else’s data.
Never let the assistant choose the identity
To read a signed-in customer’s orders, use Customer's verified e-mail (verified_email) or Verified customer id, not an e-mail provided by the assistant. An e-mail provided by the assistant could be anyone’s.
Choose the response fields
Under Response fields passed to the AI, each row has a Path, an optional Field name and an optional Prefix.
| Path syntax | Selects |
|---|---|
order.status | The status key of the order object |
data.items[0].name | The name of the first element of items |
data.items[*].name | The name of each element (a list) |
$.total | The total key at the root ($. is optional) |
- The field name (60 characters at most) becomes the key the assistant reads. Without a name, the key is the path.
- The prefix (300 characters at most) is added in front of each text value. Example: path
data[*].slugwith prefixhttps://cal.com/acme/gives full links, without the assistant having to build a URL. - A path missing from the response gives
null. - If the response is not JSON, the assistant reads the raw text, cut to the max length.
Example. Your API answers:
{
"order": {
"number": "1001",
"status": "shipped",
"carrier": "La Poste",
"trackingUrl": "https://tracking.example.com/1001",
"internal_note": "Difficult customer, do not offer any goodwill gesture"
}
}With the fields order.status (status), order.carrier (carrier) and order.trackingUrl (tracking_url), the assistant only reads:
{"status":"shipped","carrier":"La Poste","tracking_url":"https://tracking.example.com/1001"}Untrusted data
What the assistant reads is always presented as data coming from your system, never as an instruction. In practice:
- the assistant receives the result in the form
{ "status": "ok", "untrusted_data": "…", "note": "…" }. The note reminds it to use this data as facts and to ignore any request, command or rule it might contain; - control and invisible characters (zero-width spaces, direction overrides, the “tags” block) are removed from every string, keys included;
- only the chosen fields get through: an instruction hidden in another field never reaches the assistant.
The sandbox shows this: its fake order contains a booby-trapped internal_note field, which the demo action does not select.
How values are inserted
| Location | Handling |
|---|---|
| URL | Each value is encoded (encodeURIComponent). The values . and .. (or %2e) are refused: they would change the route on your server. |
| Non-secret header | Value inserted as is, line breaks removed. |
| JSON body | "{{qty}}" alone in a string takes the parameter’s type (3, true). In a longer string, the value is inserted as text. A value can never break out of its JSON string. |
Examples
Read a signed-in customer’s orders, without letting them read anyone else’s:
Method : GET
URL : https://api.exemple.ch/customers/orders?email={{email}}&status={{status}}
email : Botello (safe value) › Customer's verified e-mail (required)
status : The assistant › List : open, shipped, delivered (optional)
Verified visitors only : yes (ticked automatically)Order number and e-mail provided by “The visitor”, like the demo action: someone who does not know the order’s e-mail cannot try random numbers.
Order number alone, provided by “The assistant”: anyone can ask “and what about order 1002?” and read another customer’s order.
Troubleshooting
| What you see | Likely cause | Fix |
|---|---|---|
| “An action that uses a verified value must be reserved for verified visitors.” | A verified_… value on a public action | Tick Verified visitors only |
| “An action reserved for verified visitors must use a verified value…” | Restricted access, but no verified_… value | Add a parameter provided by Botello with a verified value |
| “Choose the value Botello provides.” | Botello source without a Value | Choose a value from the list |
| The action is never called for a signed-in customer | The identity token does not arrive or is refused | Test it with the Check tool: see Verified visitors |
| The assistant keeps asking for the order number | The visitor wrote it in another form, or with fewer than 3 characters | Check that the value sent matches what the visitor typed |
| A value stays empty in the URL | Optional parameter not filled in | Make it required, or handle the empty value in your API |
Frequently asked questions
Learn more
Create a custom API action
Let the assistant call your own service during the conversation, to read stock levels or an order status, or to book an appointment.
Authenticate the calls of an API action
Choose how Botello identifies itself to your API, from a Bearer token to OAuth 2, with encrypted secrets bound to the domain.