Skip to main content
Agent API V1 delivers replies asynchronously. After Sagepilot accepts a customer message, eligible AI-agent and human-agent replies are sent to the channel’s configured HTTPS response URL as support.message.created events.

Callback request

Important fields:
  • id is the stable webhook event ID. Use it to deduplicate retries.
  • channel_type is custom_channel, the backend identifier for Agent API.
  • payload.chat_id is Sagepilot’s resolved chat ID. It is output-only and must not be sent in later inbound message events.
  • payload.customer.external_id is the workspace-unique customer ID supplied by your backend.
  • payload.message.role is pilot for an AI-agent reply or agent for a human-agent reply.
  • payload.message.in_reply_to_external_message_id, when present, refers to your inbound message.external_id.
  • Attachment url values are short-lived Sagepilot download URLs, currently valid for 30 minutes. Download or copy files promptly.
Optional or unknown values may be omitted or null. Do not depend on customer profile fields always being present.

Verify the callback signature

Sagepilot sends these headers: Compute the expected signature over the timestamp, one period, and the exact raw request body:
Verify the signature before parsing or processing the JSON body. Also confirm that the event and header IDs/types match and reject timestamps outside your replay window.
Inbound request signatures use v1={hex_digest} over the method, path, timestamp, and raw body. Callback signatures contain the raw hexadecimal digest and use the separate {timestamp}.{raw_body} framing shown above.

Acknowledge and deduplicate

Return a 2xx response quickly after durably accepting the event. Process slow application work asynchronously. Sagepilot retries callback delivery for transport errors, timeouts, HTTP 429, and HTTP 5xx. Other HTTP 4xx responses are treated as non-retryable. Because delivery is at least once, store and deduplicate on the event id before applying side effects. Your response body is ignored and should not contain customer data or secrets.