Gateway API — connect your own service

One API: receive and send WhatsApp messages through Dialogs. Any service, bot, or n8n flow plugs into a single gateway — inbound arrives at your webhook, replies go out with one POST.

Base URL is https://dialogs.tehprof.kz/api/v1/gw/. Every request is authorized with Authorization: Bearer gw_… using your key.

Quickstart — five steps:

  1. Key. An owner or admin opens Settings → API and creates a key: a name, at least one line and at least one permission. The gw_… key is shown once — store it in your service right away. A key is revoked in the same place.
  2. GET /channels/ — find the channel_id of your lines.
  3. PUT /webhook/ — register your URL; the response returns an hmac_secret for signature checks.
  4. Receive inbound at your URL and verify the X-Wahub-Signature-V2 header.
  5. Reply with POST /messages/.

Key permissions. channels:read — the list of lines; messages:read — history and send outcome; messages:send — sending and file upload; templates:read and templates:write — reading and changing templates; webhooks:manage — webhook, subscriptions, catch-up and replay. GET /allowed/ needs messages:send and templates:read. A request without the needed permission returns 403 forbidden. A key sees only its selected lines: the rest do not exist for it and return 404 channel_not_found.

The full gateway description in OpenAPI format is open without a login: https://dialogs.tehprof.kz/api/v1/gw/schema/ (YAML; add ?format=json for JSON). Import it into Postman, Insomnia or a client generator.

Gateway API OpenAPI description

List channels. GET /channels/ returns your connected numbers — you need channel_id to send:

curl https://dialogs.tehprof.kz/api/v1/gw/channels/ \
  -H "Authorization: Bearer gw_xxx"

{
  "channels": [
    { "channel_id": "32", "chat_type": "whatsapp",
      "plain_id": "77010001122", "state": "healthy",
      "connection_mode": "cloud" }
  ]
}

Check channel state before sending. healthy means connected without warnings. degraded_quality, degraded_ratelimit and degraded_transient still allow sending, but restrictions, delays or temporary failures are possible; account for the warning and check the message status. requires_reauth, soft_disconnected and hard_disconnected cannot send until the connection is restored. Treat an unknown value as unavailable for sending. connection_mode (cloud, coexistence) describes the connection type and does not replace the state check.