Skip to main content
The generic webhook is the channel for everything else: an internal chat, a ticketing system, a CI job or a script. Your system posts a JSON message to the gateway, and the gateway posts the replies back to a callback URL you choose. Both directions carry the same shared secret.

Set it up

1

Configure ChatCLI

2

Start the gateway

3

Send a message

The gateway answers 202 Accepted at once; the progress and the reply arrive at your callback URL.

Environment variables

The request

POST to CHATCLI_WEBHOOK_PATH with Content-Type: application/json and the X-ChatCLI-Secret header: The request body is limited to the audio size cap plus 1 MB, about 21 MB with the default CHATCLI_GATEWAY_MAX_AUDIO_BYTES.

The callbacks

For each message the gateway posts JSON to CHATCLI_WEBHOOK_CALLBACK_URL, with Content-Type: application/json and the same X-ChatCLI-Secret header so your endpoint can check where it came from:
When the reply carries an image, the body also has image_b64, and image_mime and image_filename when they are known. A single message can produce several callbacks with this same shape: the “working on it” notice, progress updates while the agent works, and the final reply. There is no field telling them apart; the final reply is the last one. Any 2xx answer from your endpoint counts as delivered.

Security

  • Keep the secret long and random, and serve the endpoint over HTTPS when it is reachable from other machines.
  • audio_url and image_url are downloaded by the gateway itself, so whoever holds the secret can make the gateway fetch a URL from its own network.
  • Each message runs the agent with its tools and shell, without confirmations. Harden it with security mode.

Limits

  • A reply is cut at 3500 characters and ends with ….
  • Only text and images are posted back; voice replies are not sent on this channel.

See also

Chat gateway

How messages run, voice, images, continuity and the other channels.

Proactive messaging

Let the agent post to your callback on its own with @send.