Agent webhooks: data types and saved values
Send lists and objects, pass an id from one API to the next, and enforce steps in code.
A webhook is one of your APIs the agent can call. You give it a URL, a method, headers, a body template and the parameters the AI fills in from the conversation. For multi-step processes, a webhook can also keep values from its answer for later webhooks, and follow rules that are checked in code rather than left to the AI.
Parameter types
| Type | What the AI sends | Example |
|---|---|---|
| Text | A string | "SX-10482" |
| Whole number | An integer | 3 |
| Number | Any number | 1499.5 |
| Yes/No | true or false | true |
| List | A list of texts, numbers, yes/no values or objects | ["gift", "fragile"] |
| Object | An object with the fields you list (or any object) | {"city": "Pune", "pin": 411001} |
| Pick from a saved list | The number of an item in a saved list | 2 |
Parameters are added to the JSON body (or the query string for GET and DELETE) with their real types. A value sent in the wrong form, such as a number written as text, is converted; one that cannot be is sent back to the AI to fix, and the webhook is not called.
Templates
| Template | Filled in with |
|---|---|
{{input.from}} | The caller's number (or chat id); {{input.fromDigits10}}: its last 10 digits |
{{input.text}} | What the caller just said |
{{args.<parameter>}} | A parameter the AI filled in |
{{vars.<name>}} | A value a webhook saved earlier in the conversation |
{{args.<choice>.<field>}} | A field of the item the AI picked from a saved list |
A body field that is exactly one {{vars.…}}, or one whole number, list, object or picked item, keeps its type: "lines": "{{args.lines}}" sends the list itself, not its text.
Saved values
Under Saved values and rules, Save from the answer keeps a value from the webhook's JSON answer under a name. Later webhooks in the same conversation use it as {{vars.<name>}}; the AI never types it, so ids and URLs cannot be misread or invented. Values last for the conversation; tick Remember for next call to keep one for the caller's later conversations too.
| Path | Saves |
|---|---|
customer.id | A field inside a field |
items[0].id | A field of the first item of a list (or items.0.id) |
items | The whole list, for the AI to pick from later |
items[phone={{input.fromDigits10}}].id | The id of the item whose phone is the caller's |
items[owner.email=a@shop.in].id | A filter on a field inside each item |
Filters ignore case and outer spaces, and phone numbers match on their last 10 digits, so +91 98000 00001 matches 9800000001. When nothing is found at the path, the value is cleared rather than kept from before.
Picking from a saved list
Give a webhook a parameter of type Pick from a saved list and choose the list. The AI says only the item's number (1 for the first) and the webhook uses the item's fields, such as {{args.product.id}} and {{args.product.url}}. With Show the AI only these fields(one path per line, like items[].name), long lists fit and each item carries its number as #, so the AI can name it.
Rules checked in code
| Rule | What happens |
|---|---|
| Needs these saved values first | Not called until other webhooks have saved them; the AI is told to get them first. |
| Only after the caller confirms | Called only when the caller's latest message contains one of your words (yes, haan, ठीक है…). Not checked for actions a person approved. |
| Run at most | How many times it may succeed in one conversation, e.g. once for creating a profile. |
| Ask a person first | Each call waits on the Approvals page; it still uses the conversation's saved values when approved. |
Example: find the customer, then order
| Webhook | Settings |
|---|---|
| Find customer | GET https://api.shop.in/customers?phone={{input.fromDigits10}}; saves customer_id from items[phone={{input.fromDigits10}}].id |
| List products | Needs customer_id; saves products from items; shows the AI only items[].name |
| Place order | Parameter product picks from products; body {"customer": "{{vars.customer_id}}", "product": "{{args.product.id}}"}; only after the caller confirms; runs at most once |
The test chat in the dashboard shows the saved values as the conversation goes, so you can check each step before going live.