Webhooks

Call answer webhook

The call answer webhook (call.answer) lets your server decide, in real time, whether to accept an inbound call and which agent runs it. Unlike event subscriptions — which fire after the fact — this is synchronous: we wait for your reply before answering the phone.


When it fires

For every inbound call to a number whose routing is set to Webhook, and only when the product has a call answer webhook URL configured. Numbers on Platform routing never trigger it.

One attempt, 10-second timeout.


Configure it

Set it on the product — either from the product settings page (Call Answer Webhook section) or the API:

curl -X PATCH https://platform.eurekatechlabs.com/v1/dashboard/products/prd_xxxxxxxxxxxx \
  -H "Authorization: Bearer ..." \
  -H "Content-Type: application/json" \
  -d '{
    "answerWebhookUrl": "https://yourapp.com/call-answer",
    "answerWebhookTimeoutAction": "REJECT"
  }'
Field What
answerWebhookUrl Your HTTPS endpoint. Empty string disables it.
answerWebhookTimeoutAction REJECT or PLATFORM_FALLBACK (see Timeout).

Setting a URL for the first time mints a signing secret. Rotate it with POST /dashboard/products/{id}/answer-webhook/rotate-secret, or fire a test call with POST /dashboard/products/{id}/answer-webhook/test.


The request we send

POST https://yourapp.com/call-answer
Content-Type: application/json
X-Webhook-Timestamp: 1716717168
X-Webhook-Signature: 9f86d081884c7d659a2feaa0c55ad015a267...
X-Event-Type: call.answer
{
  "event": "call.answer",
  "call_id": "ffd09731-5543-4be8-80aa-a93c677f5599",
  "from": "+919812345678",
  "to": "+918008001234",
  "forwarded_from": "+918011111111",
  "direction": "inbound",
  "timestamp": "2026-06-16T14:20:34Z"
}
Field What
call_id The call's id — it appears again as session_id in call.ended.
from Who's calling.
to The number they dialled.
forwarded_from The upstream line, for forwarded calls — use it to tell which business the call is for. Else null.
direction Always inbound.
timestamp When we fired the request (RFC-3339).

Your reply

Return 2xx with one of these bodies.

Reject the call:

{ "accept": false, "reject_reason": "out_of_credit" }

Accept with an existing agent:

{ "accept": true, "agent_id": "agt_xxxxxxxxxxxx" }

Accept with an inline agent — the full agent config, same shape as an inline agent, tools included:

{
  "accept": true,
  "agent_config": {
    "model": "nirwana-1-flash",
    "voiceId": "asha",
    "systemPrompt": "You are the receptionist for Sharma Dental. Book appointments only.",
    "firstMessage": "Thanks for calling Sharma Dental — how can I help?",
    "tools": []
  }
}

accept: true must name an agent (agent_id or agent_config). If it names neither, or the agent_id doesn't exist / belongs to another product, or the agent_config is invalid, the call is rejected.

agent_config takes the same fields as any agent, so it can carry a welcomeMessageId to open the call with a pre-recorded greeting — the recording must already be uploaded and ready.


Timeout

If your server doesn't reply within 10 seconds (or errors), we apply the product's answerWebhookTimeoutAction:

Value Behaviour
REJECT The call is hung up.
PLATFORM_FALLBACK We use the number's routing rules + default agent, as if it were platform-routed.

Verify the signature

Same scheme as event subscriptions: X-Webhook-Signature is an HMAC-SHA256 of {timestamp}.{rawBody} using the product's answer webhook secret, as hex. Always verify before trusting the request.

Node.js

import express from 'express';
import crypto from 'crypto';

const app = express();

function verify(rawBody, ts, sig, secret) {
  const expected = crypto.createHmac('sha256', secret)
    .update(`${ts}.${rawBody}`)        // raw bytes, not parsed JSON
    .digest('hex');
  return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(sig));
}

app.post('/call-answer', express.raw({ type: 'application/json' }), (req, res) => {
  const ts  = req.headers['x-webhook-timestamp'];
  const sig = req.headers['x-webhook-signature'];
  if (!verify(req.body, ts, sig, process.env.ANSWER_WEBHOOK_SECRET)) {
    return res.status(401).end();
  }
  const call = JSON.parse(req.body);

  // Decide based on the caller / forwarded line.
  if (call.forwarded_from === '+918011111111') {
    return res.json({ accept: true, agent_id: 'agt_sharma_dental' });
  }
  return res.json({ accept: false, reject_reason: 'unknown_line' });
});

app.listen(3000);

Python

import hmac, hashlib
from fastapi import FastAPI, Request, Response

app = FastAPI()
SECRET = b"your-answer-webhook-secret"

def verify(raw: bytes, ts: str, sig: str) -> bool:
    expected = hmac.new(SECRET, f"{ts}.".encode() + raw, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, sig)

@app.post("/call-answer")
async def call_answer(request: Request):
    raw = await request.body()
    ts  = request.headers.get("x-webhook-timestamp", "")
    sig = request.headers.get("x-webhook-signature", "")
    if not verify(raw, ts, sig):
        return Response(status_code=401)

    call = await request.json()
    if call.get("forwarded_from") == "+918011111111":
        return {"accept": True, "agent_id": "agt_sharma_dental"}
    return {"accept": False, "reject_reason": "unknown_line"}

Next