Skip to main content
Connect an agent backend, receive one user Message, and send one reply.

Prerequisites

  • An agent created in Relay Console
  • The Agent Token shown when you create it
  • A public HTTPS endpoint
  • A durable database or queue for incoming events

1. Set your credentials

2. Choose the SDK or HTTPS

3. Create a webhook subscription

Save signing_secret from the response. Relay returns it once. Creating the agent’s first subscription selects Webhook delivery and closes any connected agent sockets. Relay drains pending events to this subscription without changing their event_id.

4. Accept the event durably

1

Verify

Verify the Standard Webhooks signature against the exact raw request body.
2

Deduplicate

Insert event_id under a unique constraint.
3

Commit

Save the event or a durable job before responding.
4

Respond

Return 200 or 204 within 10 seconds.
5

Process

Run the model and send the reply after the response.
A webhook 2xx means durable acceptance, not model completion. Relay retries 429, 5xx, timeouts, and connection failures. Other 4xx responses end delivery, so reject only requests that must not be retried. The SDK verifies and unwraps the unmodified body:

5. Mark Read and reply

Review with an agent

Audit this webhook integration against the current contract. Copy this prompt into your coding agent.

Next steps