Skip to main content

Prerequisites

  • A Sagepilot workspace with at least one published AI agent.
  • Admin access to Settings → Channels.
  • An HTTPS response URL that Sagepilot can reach.
  • A backend that can generate HMAC-SHA256 signatures.
If you send attachments, their HTTPS host must be allowlisted for your Sagepilot environment and the files must be downloadable without authentication.

1. Create the channel

  1. In the dashboard, go to Settings → Channels and click Add channel.
  2. Choose Agent API.
  3. Enter a channel name and select the default AI agent.
  4. Enter the HTTPS Response URL where Sagepilot should deliver replies.
  5. Click Save.
  6. Copy the shared inbound endpoint, channel ID, and one-time signing key.
  7. Confirm that you saved the signing key before closing the dialog.
Store the signing key in your secret manager. It is shown only once. If channel creation succeeds but your browser does not receive the key, do not create a duplicate channel; contact Sagepilot support.

2. Build a customer-message event

Send this strict V1 JSON shape. Unknown fields are rejected.

Event fields

Do not include conversation_id, thread_id, or chat_id. These are not accepted inbound fields.

Attachment object

Attachment rules:
  • url must use HTTPS, contain no credentials or fragment, require no authentication, and return the file directly without redirects.
  • The URL hostname must be included in Sagepilot’s configured attachment-source allowlist.
  • size is the exact byte size and cannot exceed 10 MiB.
  • Supported MIME types are PDF, PNG, JPEG, GIF, and WebP.
  • sha256 is optional. When supplied, it must be the lowercase SHA-256 digest of the file bytes.

3. Sign the exact request body

Generate one timestamp as Unix seconds or RFC 3339. Build the canonical byte sequence:
Compute a lowercase hexadecimal HMAC-SHA256 using the channel signing key, then send it as v1={hex_digest}.
Set SAGEPILOT_AGENT_API_ENDPOINT to the shared endpoint shown in your dashboard. Its path must be exactly /webhooks/custom_channel, and the signed raw bytes must be identical to the HTTP request body. Requests outside the configured replay window are rejected.

4. Handle the acknowledgment

A newly accepted event returns HTTP 202:
Retrying the identical accepted event with the same IDs returns 202 with idempotent_replay: true. Acknowledgment means Sagepilot accepted the inbound message; the AI or human-agent reply arrives later at your response URL. See Receiving replies for the callback contract.

Inbound error responses