Gateway › Integrations

Integrations

Modes

ModeReceives replies viaUse when
pullGET /webhook/<intg>/updatesYou can’t expose a public endpoint.
callbackagent-hub POSTs to your URLYou have a server that receives webhooks.
connectoragent-hub calls the platform’s bot API itselfThe platform has a long-polling bot API.

Created on the Integrations page of the web app: id [a-z0-9]{1,16} (default is reserved), pick a mode, optionally set an owner user id. Revoking is permanent; there’s no key rotation — revoke, then create a new one.

Endpoint & auth

POST /webhook/<intg>                                  send an event (pull or callback)
GET  /webhook/<intg>/updates?offset=0&timeout=30&limit=100
POST /webhook                                         the default channel (gateway config)

Authorization: Bearer <api_key>        # or an HMAC signature using the api_key
INTG="mybot"; KEY="<api_key>"; OFFSET=0
while true; do
  RESULT=$(curl -sS "http://127.0.0.1:8788/webhook/$INTG/updates?offset=$OFFSET&timeout=30" \
    -H "Authorization: Bearer $KEY")
  UPDATES=$(echo "$RESULT" | jq -r '.result[]')
  if [ -n "$UPDATES" ]; then
    echo "$UPDATES" | jq .
    OFFSET=$(($(echo "$UPDATES" | jq -r '.update_id' | tail -1) + 1))
  fi
done
offsetAcks by offset: the next GET sends the last update_id + 1.
update_idA queued reply’s update_id is its own message_id.
retentionUpdates are kept for 7 days.
clampstimeout 0–50 s (default 30), limit 1–100.
id prefixInside agent-hub, group and user ids become <intg>-<id>; you always send / receive the raw id.
ErrorMeaning
401 integration revokedThe key has been revoked.
404 unknown integrationThe id doesn’t exist.
409 integration is callback modeUsing pull on a callback-mode channel.
502 webhook gateway not runningThe webhook gateway isn’t running right now.

Integrations API (web app)

The Integrations page manages channels through the following API:

GET  /api/webhook/integrations                      list configured channels
POST /api/webhook/integrations                       create a new channel
POST /api/webhook/integrations/<intg_id>/revoke       revoke (permanent; 404 on unknown id)
GET  /api/webhook/connector-presets                  list connector presets

POST /api/webhook/integrations accepts id, name, mode (pull | callback | connector) plus mode-specific fields: callback_url for callback mode, preset or config for connector mode, with optional owner_user_id and token.

StatusWhen
201Created successfully, returns the channel’s info.
400A field required by the mode is missing (e.g. connector mode missing both preset and config).
409The id already exists.