Gateway › Connector
Connector
How it works
agent-hub (webhook gateway) --POST poll.path--> bot API (getUpdates) --items--> inbound.map (user · chat · text) --> bus
bus --> outbound.send ({chat} {text}) --POST--> bot API (sendMessage)
- Enable the webhook gateway: web app Integrations → Gateways → Enable on the webhook row.
- Get a bot token from the platform’s bot API (e.g. Zalo Bot Manager → create a bot).
- Integrations page → mode connector → pick an existing preset (e.g.
zalo) → paste the token.
Config
{
"base_url": "https://bot-api.zaloplatforms.com/bot{token}",
"poll": { "path": "/getUpdates", "body": { "timeout": "30" }, "items": "result" },
"inbound": {
"accept": { "event_name": ["message.text.received"] },
"map": {
"user_id": "message.from.id",
"chat_id": "message.chat.id",
"message_id": "message.message_id",
"text": "message.text"
},
"group_when": { "message.chat.chat_type": "GROUP" }
},
"outbound": {
"send": {
"path": "/sendMessage",
"body": { "chat_id": "{chat}", "text": "{text}" },
"message_id": "result.message_id",
"max_text_len": 2000
}
}
}
base_url | http(s), may contain {token}. |
poll.* | Every poll is a JSON POST; timeout_s 1–120; backoff increases up to backoff_max_s. |
inbound.accept | Only keeps an update that matches every path. |
inbound.map.* | A dotted path into the platform’s JSON; missing = absent. |
group_when | Matches → a group message under chat_id; no match → a DM from user_id. |
| template | Only {token}, {chat}, {text}; substituted once. |
This is an abridged copy of the real zalo preset (base_url, poll.path, inbound.accept, inbound.map, group_when, and outbound.send all match the original preset). The original preset also has poll.timeout_s, poll.backoff_max_s, more map fields (user_name, display_name, is_bot), and outbound.typing.
Preset API (web app)
GET /api/webhook/connector-presets
Returns {"presets": {"<name>": {...}, ...}} — a dict keyed by preset name. That name is exactly the value you pass as preset to POST /api/webhook/integrations.
Limits
- Text only — images, stickers, voice, files don’t get relayed.
- At-most-once:
getUpdateshas no offset/ack. - No support for edit, ack, or buttons; thread / topic are ignored.
- One poller per token.
- The poller starts automatically shortly after creation — no restart needed.