Skip to content

Guides

Website chat

Put a chat bubble on your own site with one line of HTML, and build a custom chat UI on the public endpoints.

Website chat puts a chat bubble on your own site, so visitors can ask about a product while they are looking at it. It is a channel like WhatsApp: its messages arrive in the same inbox, follow the same reply mode, and are answered from the same catalogue, knowledge and order data.

There is nothing to fetch from any provider and no webhook to register. Setup is a connection and one line of HTML.

In the dashboard: Channels → Website chat.

1. Connect it

curl -X POST https://api.getengageai.app/channels/connect \
  -H "Authorization: Bearer $ENGAGE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "providerKey": "web_widget",
    "externalAccountId": "acme.example",
    "displayName": "Acme website chat",
    "credentials": {},
    "settings": {
      "title": "Chat with Acme",
      "greeting": "Hi! Ask about a product or your order.",
      "accentColor": "#0f766e",
      "allowedOrigins": ["https://acme.example"]
    }
  }'

externalAccountId is the widget key. It goes in your site's HTML, so it is public, not a secret. It must be unique across every business on this platform, which is why your own domain is a good choice.

SettingWhat it does
titleThe header of the chat panel. Defaults to displayName.
greetingThe first message a visitor sees, before they write anything.
accentColor#rrggbb. The bubble, the header and the visitor's messages.
allowedOriginsSites allowed to send messages, e.g. https://acme.example. Empty allows any.

2. Add it to your site

<script src="https://api.getengageai.app/widget.js" data-widget="acme.example" async></script>

Paste it just before </body> on every page that should show the bubble.

On Shopify: Online Store → Themes → ⋯ → Edit code → theme.liquid, just above </body>, then save.

3. Try it

Open your site, send a message from the bubble, and open the inbox. New channels start in suggest mode, so the AI's reply waits there for approval; the visitor sees it the moment a person sends it. Turn on auto-reply once you trust the answers.

How it behaves

  • No sign-in for visitors. The browser makes up a random token and keeps it. That token is the only key to the visitor's own conversation; the server stores a hash of it, never the token itself.
  • Replies arrive by polling: every few seconds while the panel is open, more slowly after a quiet minute, and not at all while it is closed.
  • Visitors see only what was sent: their own messages and the replies a person or the AI actually delivered. Drafts waiting for approval never appear.
  • It cannot break your site. It draws inside its own isolated area, so your theme's CSS does not reach it and its CSS does not reach your page. Replies are shown as plain text, never as HTML.
  • Limits. 12 messages a minute per visitor and 60 per IP address. Past that, the visitor sees that their message was not sent.

allowedOrigins stops other websites embedding your widget and running up your AI usage. It is not authentication: any program that is not a browser can claim any origin.

Order questions in the chat

A visitor is anonymous, so the widget never vouches for who they are. To hear about an order they give the order number and the email or phone used on it, which the AI asks for. Typing an email alone never lists anyone's orders. See order questions.

Building your own chat UI

The script is a thin client over three public endpoints. Use them directly for a native app or a custom design.

# Appearance
curl https://api.getengageai.app/widget/acme.example/config

# Send — the same clientMessageId twice is one message, so retry freely
curl -X POST https://api.getengageai.app/widget/acme.example/messages \
  -H "Content-Type: application/json" \
  -d '{ "visitorToken": "<random, at least 20 characters, kept by the client>",
        "clientMessageId": "<unique per message>",
        "text": "Is the Ridgeline tent still in stock?" }'

# Read the conversation, oldest first
curl https://api.getengageai.app/widget/acme.example/messages -H "X-Widget-Visitor: <the same token>"

The token goes in a header rather than the URL because URLs end up in access logs. Generate it with a cryptographic random source and treat it like a password: anyone holding it can read that visitor's conversation.

ResponseMeaning
{ "status": "accepted" }Queued for a reply
{ "status": "duplicate" }That clientMessageId was already received
401Missing visitor token, or a site not in allowedOrigins
404No live widget with that key
429Too many messages; wait and retry