Agent webhooks
Let another system send events to your agent. The agent handles each event with your prompt and can post its answer in Slack.
A webhook gives your agent a URL. Another system sends an event to that URL: an alert from Alertmanager, a deal from a HubSpot workflow, a record change in Attio, or a request from your own code. Sokko puts the event in a queue. Then the agent takes one turn for the event and follows the prompt you wrote for that webhook.
The answer goes to one of two places:
- a Slack channel of the agent's own Slack app. Sokko posts the answer as the agent's bot.
- nowhere. The agent acts with its tools, and the answer stays in the dashboard conversation.
Webhooks work with Hermes, OpenClaw, Eve and Flue agents. You find them in the Channels tab of the agent, in the Webhooks section. Owners and admins can add, change and delete webhooks.
Each event starts one agent turn, and each turn uses the workspace's AI credits. The limits below keep a noisy sender from running many turns.
Add a webhook
Open Channels → Webhooks
Go to your agent in the dashboard, open the Channels tab and click Add webhook.
Start from a preset
Under Start from, choose Alertmanager, HubSpot, Attio or Blank. A preset only fills the fields. You can change every field after.
Give it a name and an origin
The name is for you, for example "Production alerts". The origin is a label that the agent reads with each event, for example "Alertmanager · production". It tells the agent where the event comes from.
Choose how the sender proves itself
- Token: Sokko makes a token. The sender puts it in the
Authorizationheader. Use this for Alertmanager, HubSpot workflows, CI jobs and curl. - Signature: the sender signs each request with its own secret. Use this for Attio and other tools that sign their webhooks.
You cannot change this choice later. To switch, create a new webhook.
Write the prompt
Tell the agent what to do with each event, in up to 4,000 characters. For example: "Say in two lines what happened and what the team should do next." Read Write a safe prompt before you save.
Choose where the answer goes
Under Answer in, pick a Slack channel or Do not post. The list shows the channels of the agent's Slack app, public and private.
The agent's Slack bot must be a member of the channel. If it is not, invite
it in Slack first (/invite @your-bot in the channel). If the agent has no
Slack connection yet, only Do not post is available. Connect Slack from
the same Channels tab to post answers.
Check the event rules
The presets fill these for you. For Blank you can leave them empty. See Event rules.
Create the webhook
Click Create webhook. What comes next depends on the authentication you chose.
Token webhooks: copy the token now
Sokko shows the webhook URL and the token. Copy the token at once. Sokko shows it only once. If you lose it, make a new one (see Make a new token or secret).
The dialog also shows setup help for the preset and a curl example. Click Send a test event to queue a sample event. The webhook row shows the result when the agent answers, and the answer appears in your Slack channel if you picked one.
Signature webhooks: paste the sender's secret
Sokko shows the webhook URL. Then:
- Create the webhook in the sender's tool with this URL.
- Copy the sender's signing secret and paste it in Sokko.
- Send a first event from the sender.
Until you save the secret, Sokko refuses every event sent to the URL. The row shows Needs secret. You can click Finish later and paste the secret from the row menu afterwards.
"Send a test event" is not offered for signature webhooks. Only the real sender can sign an event with its secret.
The webhook URL
Each webhook has its own public URL:
https://sokko.ai/api/hooks/<webhook-id>The URL alone does not let anybody send events. Each request still needs the token or a valid signature.
Send an event with curl
This example sends one event to a token webhook. Replace <webhook-id> and
<token> with your own values.
curl -X POST 'https://sokko.ai/api/hooks/<webhook-id>' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'X-Sokko-Event: deploy.finished' \
-H 'X-Sokko-Thread: release-42' \
-H 'Idempotency-Key: release-42-finished' \
-d '{"service": "api", "version": "1.42.0", "result": "success"}'The body must be a JSON object or a JSON array, up to 256 KB. The headers
X-Sokko-Event, X-Sokko-Thread and Idempotency-Key are optional.
X-Sokko-Event and X-Sokko-Thread count only when the event rules are
empty, as in the Blank preset.
Sokko answers at once. It does not wait for the agent:
| Status | Meaning |
|---|---|
202 | Sokko accepted the event. The body is {"eventId": "…", "duplicate": false}. For a duplicate, duplicate is true and no new turn runs. |
400 | The body is missing or is not JSON. |
401 | The URL, token or signature is wrong, the webhook is off, or a signature webhook has no secret yet. |
402 | The workspace has no active subscription. |
413 | The body is larger than 256 KB. |
429 | Too many events, or the queue is full. Wait for the time in the Retry-After header, then send again. |
503 | Sokko could not queue the event now. Send it again later. |
Event rules
Event rules tell Sokko where to find two values in each event. A rule is a field path:
- a body path: keys and array positions joined by dots, for example
events.0.event_type. - a header:
header:and the header name, for exampleheader:X-Sokko-Event.
The value must be a text or a number. Sokko cuts it at 200 characters. You
cannot read credential headers, such as Authorization or a signature
header, because the value would end up in the agent's conversation.
| Rule | What it does | When it is empty |
|---|---|---|
| Event type | A short label that the agent reads, for example firing or record.updated. | The X-Sokko-Event header, else the body field type, else event. |
| Thread | Events with the same thread value belong together. They share one conversation and one Slack thread. | The X-Sokko-Thread header, else each event gets its own thread. |
| Duplicates | Fixed rule. | Sokko uses the Idempotency-Key header, else the exact body. |
How Sokko handles events
- One at a time per agent. The agent handles one webhook event at a time. The other events wait in the queue, oldest first.
- Events of one thread are grouped. When the agent starts on an event, Sokko adds the other waiting events of the same thread to the same turn, up to 10. The agent reads them in order and answers once.
- Duplicates are dropped. If the same
Idempotency-Key, or the same body when there is no key, arrives again on the same webhook within one hour, Sokko answers202with"duplicate": trueand runs no new turn. - Slack threads. The first answer of a thread is a new Slack message. The next answers of the same thread go into its Slack thread.
- Long answers are cut. Sokko cuts a Slack answer at 3,500 characters.
Sokko also turns
@channel,@hereand@everyoneinto plain text, so an event cannot ping the whole channel. - When the agent is not running. If the agent is suspended or still starting, its events wait. An event that the agent does not take within 24 hours fails.
- Retries. When a turn or a Slack post fails for a temporary reason, Sokko tries again, up to 5 times. Sokko saves the answer before it posts to Slack, so a failed post does not run the turn again.
Limits
- 60 new events per minute per webhook.
- 100 waiting events per webhook.
- 20 webhooks per workspace.
Read the conversations
Each thread is a conversation of the agent. In the webhook's menu, click Open conversations to read them in the agent's chat. Owners and admins can read them. They cannot write in them.
Write a safe prompt
The event text comes from outside your workspace. You do not control it. A CRM note, a form field or an alert label can hold text that somebody else wrote, and that text can look like an instruction.
Sokko tells the agent that the event is data and that it must never follow instructions inside it. But a model can still be misled. The agent also keeps its normal tools during a webhook turn: the same tools, apps and access it has in chat.
So write a prompt that says clearly:
- what the agent must do with the event,
- what it must not do, for example "Do not send emails. Do not change records. Only explain."
Before you add a webhook for a source that carries text from customers or leads, check which tools and apps the agent can use. Remove the access it does not need for this job.
Examples
Alertmanager
Use the Alertmanager preset. It uses a token, reads the event type from
status and the thread from groupKey. So the "firing" and "resolved"
messages of one alert group land in the same Slack thread.
Add a receiver to your Alertmanager configuration:
route:
routes:
- receiver: sokko-agent
continue: true
receivers:
- name: sokko-agent
webhook_configs:
- url: https://sokko.ai/api/hooks/<webhook-id>
send_resolved: true
max_alerts: 20
http_config:
authorization:
credentials: <token>continue: true keeps your other alert routes working. Keep the token in a
secret file (credentials_file) instead of in the configuration when you can.
HubSpot
Use the HubSpot preset. In your HubSpot workflow:
- Add the action Send a webhook, method
POST, with the webhook URL. - Set authentication to API key.
- Add a secret whose value is
Bearer <token>. - Set the key name to
Authorizationand the location to Request header.
One workflow sends one kind of event, so the preset leaves the event type empty. When the first event arrives, open the conversation, find the record id in the body, and set the Thread rule to that field. Then all events of one record share a thread.
Attio
Use the Attio preset. It uses a signature: header Attio-Signature,
encoding hex, no prefix. It reads the event type from
events.0.event_type and the thread from events.0.id.record_id.
- Create the webhook in Sokko.
- In Attio, create a webhook with the Sokko URL and choose the events you want.
- Copy Attio's signing secret and paste it in Sokko.
- Make one of those events happen in Attio, then check the webhook row.
Check the thread field on the first event. If Attio sends the record id in another place, change the Thread rule.
Manage a webhook
Turn a webhook off
Use the switch on the webhook row. While a webhook is off, its URL refuses
every event with 401. Turn it on again to accept events.
Make a new token or secret
In the webhook's menu, click New token or secret.
- Token webhook: Sokko makes a new token and shows it once. The old token stops working at once. Give the new token to the sender.
- Signature webhook: paste the new signing secret from the sender.
Edit or delete a webhook
In the webhook's menu, click Edit to change the name, origin, prompt, answer channel or event rules. Click Delete to remove the webhook. Its URL stops working at once.
If posts to Slack fail, check that the Slack bot is still in the channel and that Slack is still connected to the agent. The webhook row shows the error.