---
name: thoughtly-webhooks
description: Receive Thoughtly call and message events in an app or a local agent. Use for signed HTTPS callbacks, waiting for a call to end, supplying inbound instructions, or responding to live tool requests.
---

# Thoughtly events and webhooks

Use the connected Thoughtly origin, or `https://agents.thoughtly.com` for the public service. For a local agent, use MCP `wait_for_events` or `GET /v1/events`. No public address is required. For a hosted application that should receive callbacks, check `POST /v1/webhooks` in the environment’s `/openapi.json`. [Events guide](https://agents.thoughtly.com/docs#events-and-errors)

**Listen locally.** Start listening before the call. Pass `wait_seconds: 20`, save `next_cursor`, and deduplicate event IDs. Use the `messages` channel for SMS and keep a cursor per channel. On `call.ended`, read `get_call` for the matching call ID. For `call.tool_requested`, use `claim_event` before executing an authorized action, then `respond_to_event` with the same claim token and the actual result. Reconcile an uncertain side effect before retrying.

**Receive signed HTTPS events.** Register the owner's public HTTPS URL on port 443 with `POST /v1/webhooks`, an `Idempotency-Key`, and `{"url":"https://example.com/events"}` using their actual URL. Store the returned signing secret. On each request, verify `X-Thoughtly-Signature` against `v1=` plus the hex HMAC-SHA256 keyed by that secret over the exact `X-Thoughtly-Timestamp` header value, a literal dot, and the unmodified body bytes. Use a constant-time comparison and reject timestamps outside five minutes. Deduplicate `X-Thoughtly-Event-Id` after verification, and return 2xx promptly.

For `call.incoming`, return JSON such as `{"prompt":"Ask for the delivery reference."}` within the five-second deadline. Saved instructions cover an offline agent. Completion events only need acknowledgment. Use the event feed to recover missed notifications. A CRM sending events **into** Thoughtly uses an [Agent Worker trigger](https://agents.thoughtly.com/recipes/crm-trigger-call.md).
