Agent webhooks
Each agent can have two webhooks, under Publicação → Telefone (publish → phone):
| Inbound Webhook | Data Webhook | |
|---|---|---|
| When | When a call reaches the agent, before it speaks | When the call ends, after post-call processing |
| Calls | Inbound, by phone or WhatsApp (Inbound agents only) | Inbound and outbound, by phone or WhatsApp, plus public link and widget calls |
| Your system | Answers with facts about the caller, which the agent uses in the conversation | Stores the transcript, extracted data, evaluations and actions |
| Event | call.inbound | call.completed |
| Response time | Up to 5 seconds | Up to 10 seconds |
| Retries | None: the call does not wait | Up to 3 attempts |
Both requests are JSON POSTs and are signed with the agent's secret (see ).
Set up
- Open the agent and click Publicação (publish).
- In the Telefone (phone) tab, enter the URL under Inbound Webhook and/or Data Webhook. The URL must start with
https://and be a public address. - Click outside the field or press Enter to save.
- Click Inicializar (initialize) to send a test request to the URL (see ).
- Publish the agent. Like the rest of the call settings, the webhooks apply from the published version.
To stop using a webhook, clear the URL (the × button) and publish again.
Anyone who can edit the agent (owners, admins and members) can change the webhooks and see the signing secret.
Inbound Webhook
When an inbound call reaches the agent, Diska sends it to the Inbound Webhook before the agent speaks. The answer can carry:
variables: facts about the caller (name, plan, balance, last order…). The agent receives them as facts about this call and uses them in the conversation. In a flow-mode agent they are available as variables ({{nome}}).metadata: your system's references (the customer's CRM ID, a session ID…). The agent does not see them; they come back in the , in themetadatafield.
Request
{
"event": "call.inbound",
"test": false,
"agent_id": "61e5f9d7-06eb-43ad-a8a5-056ff7b448fd",
"organization_id": "0ba43fdf-…",
"channel": "phone",
"direction": "inbound",
"from_number": "+244923000001",
"to_number": "+244959092450",
"created_at": "2026-11-08T10:15:02.418Z"
}
| Field | Description |
|---|---|
channel | phone (DISKA number or SIP trunk) or whatsapp |
from_number | The caller's number, as the network delivered it. May be null if the caller hides their number. |
to_number | The agent's number. On a WhatsApp call it is null. |
test | true only on Inicializar requests |
Response
Answer 200 with JSON:
{
"variables": {
"nome": "Ana Silva",
"plano": "Gold",
"saldo": "12 500 Kz"
},
"metadata": {
"crm_id": "CL-48213"
}
}
- Variable names are normalized to lowercase, without accents or spaces (
Nome do cliente→nome_do_cliente). - At most 20 variables, up to 200 characters each. Values are kept on one line.
- A variable whose value reads like an instruction (for example "ignore the previous instructions") is dropped. The agent receives variables as facts, never as orders.
metadata: up to 20 pairs, 500 characters per value.- A
200or204with no body is valid: the agent answers without extra facts. - We also accept
{"call_inbound": {"custom_variables": {…}, "metadata": {…}}}, for integrations moving from another platform.
If your system does not answer
The Inbound Webhook never refuses a call. If your system takes longer than 5 seconds, answers with an error, a redirect or something that is not JSON, the agent answers anyway, without those facts. There are no retries: the caller is waiting.
Answer fast: every second your system takes is another second of ringing for the caller.
Example receiver
from fastapi import FastAPI, Request
app = FastAPI()
@app.post("/diska/inbound")
async def inbound(request: Request):
call = await request.json()
customer = await find_customer(call["from_number"]) # your CRM
if customer is None:
return {}
return {
"variables": {"nome": customer.name, "plano": customer.plan},
"metadata": {"crm_id": customer.id},
}
app.post('/diska/inbound', express.json(), async (req, res) => {
const customer = await findCustomer(req.body.from_number) // your CRM
if (!customer) return res.json({})
res.json({
variables: { nome: customer.name, plano: customer.plan },
metadata: { crm_id: customer.id }
})
})
Verify the signature before answering with customer data (see ).
Data Webhook
When a call ends and post-call processing finishes (transcript, data extraction, evaluations, SMS and actions), Diska sends the data to the Data Webhook. The body is the same as the call.completed event of organization webhooks, with two more fields: call and metadata.
{
"event": "call.completed",
"test": false,
"call_id": "8f1c2d3e-…",
"session_id": "sess_…",
"agent_id": "61e5f9d7-06eb-43ad-a8a5-056ff7b448fd",
"organization_id": "0ba43fdf-…",
"ended_at": "2026-11-08T10:18:44.120Z",
"caller_contact": "+244923000001",
"extracted_data": { "nome": "Ana Silva", "motivo": "Alterar o plano" },
"evaluations": [],
"sentiment": "positive",
"post_call_sms": [],
"custom_actions": [],
"executed_actions": [],
"transcript": [
{ "role": "assistant", "content": "Olá Ana, em que posso ajudar?" },
{ "role": "user", "content": "Queria mudar para o plano Gold." }
],
"call": {
"id": "8f1c2d3e-…",
"channel": "phone",
"direction": "inbound",
"status": "completed",
"end_reason": "user_requested_end",
"started_at": "2026-11-08T10:15:03.002Z",
"ended_at": "2026-11-08T10:18:41.870Z",
"duration_seconds": 219,
"from_number": "+244923000001",
"to_number": "+244959092450"
},
"metadata": { "crm_id": "CL-48213" }
}
| Field | Description |
|---|---|
call_id | The call's ID in History and in the DISKA API (GET /v1/calls/{id}) |
extracted_data | The values of the agent's information extractors |
evaluations | The configured post-call evaluations |
transcript | The conversation, turn by turn |
call.end_reason | The end reason (see Errors and end reasons) |
metadata | What the Inbound Webhook returned in metadata (empty if none) |
With Redact personal data on, the transcript and extracted data arrive already masked (for example [TELEFONE]). The caller's line number is kept.
Which calls are sent
- Completed calls of published agents: by phone (DISKA number or SIP trunk), WhatsApp, public link and widget, inbound and outbound (including campaigns and DISKA API calls).
- Not sent: test calls from the Testar (test) panel and the Test Center, DISKA API text chats, and calls that failed or were cancelled.
Responses and retries
- Answer
2xxwithin 10 seconds. Queue the event and process it later. - A
5xx,408,429or no response is retried, up to 3 attempts, 1 and 2 seconds apart. - A
4xx(other than408/429) is not retried: your system refused the request. - Redirects (
3xx) are not followed. X-Diska-Deliveryis the same on every attempt for the same call: use it to avoid processing a call twice.
Test with Inicializar
The Inicializar (initialize) button sends a test request to the URL in the field, even before you save it:
- Inbound Webhook: sends a
call.inboundwith"test": trueand made-up numbers. Diska shows the response code, the time taken, and the variables the agent would receive, or why a variable was dropped. - Data Webhook: sends a
call.completedwith"test": true, a sample conversation and zeroed IDs.
Test requests are signed like real ones. To tell tests from real calls, check the test field.
Verify the signature
Each request carries these headers:
Content-Type: application/json
User-Agent: Diska-Webhooks/1.0
X-Diska-Event: call.inbound | call.completed
X-Diska-Delivery: <delivery identifier>
X-Diska-Timestamp: <unix seconds>
X-Diska-Signature: sha256=<hex>
The signature is the hex HMAC-SHA256 of the text {X-Diska-Timestamp}.{body} with the agent's signing secret. You find the secret under Publicação → Telefone → Segredo de assinatura (signing secret); it starts with whsec_. Each agent has its own; the same secret signs both webhooks.
Compute the signature over the raw body, exactly as received. The code is the same as for organization webhooks: see the Python, Node.js and PHP examples in Webhooks › Verify the signature. Reject requests older than 5 minutes.
Agent or organization webhooks?
| Agent webhooks | Organization webhooks | |
|---|---|---|
| Where it is set up | Publicação → Telefone, per agent | Through the DISKA API (webhooks:manage) |
| Before the call | Yes: Inbound Webhook | No |
| After the call | Data Webhook, for this agent's calls | call.completed for every call in the organization |
| Signature | The agent's secret (whsec_…) | Each endpoint's secret (dskw_…) |
You can use both: a completed call is sent to every webhook configured.
Troubleshooting
| Symptom | What to check |
|---|---|
| The agent does not use the Inbound Webhook's facts | Was the agent published after saving the URL? Use Inicializar and check that the variables appear and whether any was dropped. |
| Inicializar says "Sem resposta a tempo" (no response in time) | Your system takes longer than 5 seconds. Answer first with what you have and do the rest afterwards. |
| "Este endereço não é público" (this address is not public) | The URL points to a private address (internal network, localhost). Use a public https:// address. |
| The Data Webhook does not arrive | Was it a test call? Was the agent published with the URL? Did the call end as completed? |
| The signature does not match | Use the raw body, without re-serializing the JSON, and the right agent's secret. |
Transfers
What happens on the line when the agent hands a call to a person — destinations by number type, caller ID, accepted SIP URIs, costs and troubleshooting.
Errors and end reasons
What each end reason of a phone call in History means, why a call may never reach the agent and what to do in each case.

