webchat-hub

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

BusinessVisitor chatBot instance
Dental Worldhttps://webchat.wenjyue.com/dental-worldwebchat-dental
Lima Bintang Logisticshttps://webchat.wenjyue.com/lima-bintangwebchat-lima-bintang
Pelangi Capsule Hostelhttps://webchat.wenjyue.com/pelangiwebchat-pelangi
Senai Room Rentalhttps://webchat.wenjyue.com/senai-appwebchat-senai-app
Southern Homestayhttps://webchat.wenjyue.com/southern-homestaywebchat-southern
Yoong Mei Trading & Transporthttps://webchat.wenjyue.com/yoongmeiwebchat-yoongmei

Open operator inbox

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

  1. Sign in at /admin and open the API tab in the left navigation.
  2. Click Generate key, give it a name (e.g. rainbow-ai prod) and choose one business or All businesses.
  3. 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."}'
opBody fieldsResult
send_textphone, text{"ok":true,"sent":true,"messageId":"43"}
send_mediaphone, mediaUrl, mimetype, fileName, captionsame
send_typing / send_pausedphonetyping 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>/healthno 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