Skip to content

Incoming webhooks

A webhook posts messages into one channel under its own name. It accepts Slack’s message format, so a tool that sends to a Slack incoming webhook usually needs only the new address.

  1. Open the channel, then ⋯ › Webhooks.
  2. Type a name, choose an icon if you want one, and choose Add.
  3. Copy the Address. Sort shows it only once: it keeps only a hash of the secret.

Anyone who can read the channel sees its webhooks. The person who made a webhook, or a workspace owner, can Renew address (the old address stops at once) or Remove it. Guests cannot make webhooks. A webhook posts only while the person who made it can still post in the channel; renewing it makes you its owner.

Send a POST to the address with a JSON body, or a form with the JSON in the payload field:

Terminal window
curl -X POST -H 'Content-Type: application/json' \
-d '{"text": "*Deploy* of `web` finished. <https://example.com/runs/42|Run 42>"}' \
https://api.trysort.com/hooks/<secret>

Sort answers ok, or an error code with a 4xx status (no_text, invalid_payload, msg_too_long, channel_not_found, channel_is_archived, rate_limited with Retry-After, team_disabled).

What Sort reads:

  • text with Slack’s marks: *bold*, _italic_, ~strike~, code, <url|label> links and emoji names such as :white_check_mark:.
  • blocks: section (with fields and a link button), header, context, divider, image, actions with link buttons and rich text. Other blocks show their text.
  • attachments: pretext, author, title, text, fields, footer and image.
  • <!channel>, <!here> and <!everyone> mention everyone in the channel. Slack user and channel IDs show as text: they match nobody in Sort.
  • Images show as links: the apps load nothing from outside servers.

A script that posts and then replies in the thread can switch too. Use https://api.trysort.com/hooks/api/ as the API base address, and the last part of the webhook’s address (it starts with sw_) as the bearer token:

Terminal window
curl -X POST -H 'Authorization: Bearer <token>' -H 'Content-Type: application/json' \
-d '{"channel": "ignored", "text": "Build started"}' \
https://api.trysort.com/hooks/api/chat.postMessage

The answer has Slack’s shape: {"ok": true, "channel": "...", "ts": "<message id>"}. Send that ts as thread_ts to reply in the thread. The webhook posts only into its own channel, so channel is not used. No other part of Slack’s API is available.

  • About one message a second for each webhook, with short bursts, and 256 KB for a body. Slack’s 40,000-character text limit applies.
  • A webhook message never starts Sort AI, and Sort AI treats its text as data.
  • A read-only or locked workspace refuses webhook messages.