Webchat Hub
Browser chat for your website visitors, an operator inbox for your team, and a bot API so an AI assistant (e.g. rainbow-ai) can answer automatically.
Chat pages
| Business | Visitor chat | Bot instance |
|---|---|---|
| Dental World | https://webchat.wenjyue.com/dental-world | webchat-dental |
| Lima Bintang Logistics | https://webchat.wenjyue.com/lima-bintang | webchat-lima-bintang |
| Pelangi Capsule Hostel | https://webchat.wenjyue.com/pelangi | webchat-pelangi |
| Senai Room Rental | https://webchat.wenjyue.com/senai-app | webchat-senai-app |
| Southern Homestay | https://webchat.wenjyue.com/southern-homestay | webchat-southern |
| Yoong Mei Trading & Transport | https://webchat.wenjyue.com/yoongmei | webchat-yoongmei |
Embed on your website
Add an iframe. The site's domain must be listed in the tenant's frameAncestors.
<iframe src="https://webchat.wenjyue.com/dental-world/embed"
style="width:380px;height:560px;border:0;border-radius:12px"
title="Chat with Dental World"></iframe>
Connect a bot (API)
A bot talks to the hub with the same contract as a WhatsApp bridge (wa-hub). Each chat is addressed as web:<conversationId>.
1 · Generate an API key
- Sign in at /admin and open the API tab in the left navigation.
- Click Generate key, give it a name (e.g.
rainbow-ai prod) and choose one business or All businesses. - Copy the key (starts with
wchk_). It is shown only once; store it in your bot's secret store. Revoke it from the same tab at any time.
Once any active key covers a business, every bot call for it must present a valid key (or the legacy TENANT_<ID>_SEND_TOKEN).
2 · Receive visitor messages (hub → bot)
When a chat is in bot mode, each visitor message is POSTed to your bot:
POST <your-bot-url>/inbound
X-Inbound-Key: <shared inbound key>
Content-Type: application/json
{"instanceId":"webchat-dental","from":"web:c_AbC123","pushName":"Web visitor",
"text":"What are your rates?","messageType":"text","isGroup":false,"fromMe":false,
"timestamp":1790000000,"messageId":"wch-42","participant":"","phoneNumber":""}
The bot URL and inbound key are set on the hub server (TENANT_<ID>_SUBSCRIBER_URL, TENANT_<ID>_INBOUND_KEY). Ask the hub admin to change them. While an operator owns a chat, nothing is forwarded.
3 · Reply (bot → hub)
curl -X POST https://webchat.wenjyue.com/i/webchat-dental/send \
-H "x-api-key: wchk_…" -H "content-type: application/json" \
-d '{"op":"send_text","phone":"web:c_AbC123","text":"Our rates start at RM35/night."}'
| op | Body fields | Result |
|---|---|---|
send_text | phone, text | {"ok":true,"sent":true,"messageId":"43"} |
send_media | phone, mediaUrl, mimetype, fileName, caption | same |
send_typing / send_paused | phone | typing indicator on/off |
Auth header: x-api-key, x-bridge-token or Authorization: Bearer. Responses: 401 bad key · 404 no_conversation · 409 conversation_closed · 202 operator_owned (a human took over; the reply is dropped, not an error).
Other bot endpoints
GET /i/<instanceId>/health | no auth; {"ok":true,"state":"open","transport":"webchat"} |
GET /i/<instanceId>/conversations/web:<id>/messages?after=<msgId> | conversation history (auth) |
/api/bot/<profile>/… | same routes addressed by profile instead of instance id |
webchat-hub 0.7.1-go+otp20261031