Custom integrations

Post your app’s messages into a Slack channel, and get the replies back.

Send a message

POST JSON to the webhook URL from your instructions email. Each message shows up in the integration’s channel.

curl

curl https://api.fordly.ai/api/v1/hooks/wh_… \
  -H "Content-Type: application/json" \
  -d '{"from": "Lena Berg", "text": "Where is PO 4471?", "id": "msg_123"}'
fromrequiredWho wrote it, as Slack shows it
textrequiredThe message
idoptionalYour message id; sent twice, posted once

Fordly answers 202. A 422 names the field to fix; a 429 says in Retry-After when to try again.

Get replies

Save the URL replies go to with the key from your email. An empty URL stops replies.

curl

curl -X PUT https://api.fordly.ai/api/v1/hooks/wh_…/reply-url \
  -H "Authorization: Bearer whk_…" \
  -H "Content-Type: application/json" \
  -d '{"reply_url": "https://your-app.example/fordly"}'

Fordly POSTs each reply written in the channel there; answer with any 2xx.

POST https://your-app.example/fordly

{
  "from": "Anna",
  "text": "Yes, Friday the 12th.",
  "id": "out_8f2c1a"
}

On a 5xx, a 429 or no answer, Fordly tries again five times over about a minute. After that, Slack shows the reply as not delivered. A retry keeps its id: save each reply once by its id.

Check the signature

Each reply carries a Fordly-Signature header: t, the time sent, and v1, an HMAC-SHA256 of t, a dot and the body, keyed with your signing secret.

Python

import hashlib, hmac, time

def is_from_fordly(body: bytes, header: str, secret: str) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(","))
    signed = parts["t"].encode() + b"." + body
    expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
    recent = abs(time.time() - int(parts["t"])) < 300
    return recent and hmac.compare_digest(expected, parts["v1"])