Let the site's chat call a function
set_function_chat_actionOpen one of the site's functions to its chatbot ("call my API"): when a visitor asks something the function answers, the chat asks for the inputs listed here, calls the function with only those, and tells the visitor its reply. Example: a repair shop's "check my repair status" by job number. The function receives POST { "source": "chat", "inputs": { ... } } and should answer JSON { "reply": "one sentence for the visitor", "buttons": [...], "image": "https://..." }: buttons (optional, up to 3) are { "label", "url" } to open an https link or { "label", "reply" } to send that text as the visitor's next message, labels at most 20 characters; image (optional) is one https picture shown with the reply. Anything else in a button is dropped. The website chat and WhatsApp both show them. verified_customer_only keeps it for visitors who proved who they are first. read_only: true says it only looks things up and changes nothing, so a test chat (Test & improve) calls it for real; other functions are shown there as "would call" and never run. Pass close: true to stop the chat calling it. It affects what visitors are told as soon as the function is deployed.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"site_id": "<site_id>",
"function": "<function>"
},
"name": "set_function_chat_action"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| when | No | When the chat should call it, in the owner's words: "a customer asks how their repair is going" | |
| close | No | true: the chat no longer calls this function | |
| label | No | What it is called for the owner, e.g. "Check repair status" | |
| inputs | No | ||
| site_id | Yes | The site, from list_sites | |
| function | Yes | The function's name (slug), display name or id, from list_functions | |
| read_only | No | ||
| user_goal | No | Optional: the user's goal behind this call, in one short sentence of plain words (e.g. "add a page so customers can book tables"). No names, emails or other personal details. | |
| verified_customer_only | No |