Skip to Content
Developer docsBeta
Website & app chat

Security and limits

Public site keys, allowed sites and apps, test and live keys, the limits in numbers, and the CSP lines for your site.

Site keys are public

A site key (mwg_pk_live_… or mwg_pk_test_…) ships inside your page or app, so it isn't a secret. What protects it is the list of allowed sites and apps you give it:

  • Websites are checked by the browser's Origin header, which a web page can't fake. An entry is an exact origin (https://shop.example.com, http://example.com:8080) or https://*.example.com for any subdomain at any depth (never example.com itself, and a wildcard takes no port).
  • Apps send their iOS bundle ID or Android package name (X-Mawgood-App: ios:com.example.app). An honest app can't use another app's key, but a modified app can fake its ID. App protection reduces misuse; it doesn't prevent it entirely. The limits below cap what such misuse can spend.
  • The list stops other websites from using your key, because browsers set Origin themselves. It doesn't stop a script running outside a browser: any client can send any Origin header. The limits below cap what such a script can spend.
  • Up to 20 sites and apps per key. Each call is checked on every request, and the browser only gets CORS answers for the origin it was checked against, plus the origin_not_allowed refusal itself when the key is valid (it names only the origin to add).

Change key makes a new key with the same sites and apps; the old one keeps working for 7 days, so you can update your site or app (End the old key now stops it early). Revoke key stops a key at once on every site and app, for a key that leaked. Open bubbles on a revoked or expired key end.

The two secrets never ship: your public API key (mwg_sk_…) and the identity secret (mw_sk_…) stay on your server.

Test and live keys

KeyWorks from
mwg_pk_test_The sites and apps you list, plus localhost, 127.0.0.1 and [::1] on any port, always.
mwg_pk_live_Only the sites and apps you list. Loopback addresses never work, and can't be added to the list.

Both talk to the same Mawgood: a test key's chats are real chats, answered by the Mawgood and charged like any other (1 credit per AI reply). Use a test key on your machine and a live key on your real site or app.

Limits

WhatLimitOver it
Opening a session30 a minute per IP429 rate_limited, with Retry-After
Every chat API call600 a minute per IP429 rate_limited
New chats per device10 a day409 new_chats_limit
New chats per IP, per Mawgood200 a day409 new_chats_limit
New chats per Mawgood2,000 a day (you can lower it)409 chat_volume_limit
Messages per chat20 a minute429 rate_limited
Uploads per visitor30 every 10 minutes429 rate_limited
"Typing" signals per chat30 a minute429 rate_limited
AI replies per Mawgood on this channel1,000 an hour (you can lower it)The chat goes to your team, and the bubble says so
Live connections3 per visitor, 300 per IP per MawgoodRefused; the SDKs wait and retry
A file10 MB: JPEG, PNG, WebP, GIF images, PDF, and voice notes413 file_too_large, 415 unsupported_type
A message4,096 characters, up to 10 files400 validation_failed

Many real customers in Egypt share one mobile IP (carrier NAT), which is why the per-IP limits are high. Images and voice notes your visitors send are read by AI (payment receipts, transcription) within an hourly budget per Mawgood the same size as the reply cap; past it they are kept for your team, unread.

The SDKs handle all of this for you: they back off on 429, keep messages that failed in their outbox, and show «try again later» on the new-chat limits.

Content-Security-Policy

If your site sends a Content-Security-Policy header, the web bubble needs these sources (production hosts; apps don't use CSP):

Content-Security-Policy
script-src  https://cdn.mawgood.ai;
connect-src https://mawgood.ai wss://rt.mawgood.ai https://*.r2.cloudflarestorage.com;
img-src     https://mawgood.ai https://*.r2.cloudflarestorage.com blob: data:;
media-src   https://*.r2.cloudflarestorage.com blob:;
style-src   'unsafe-inline';
font-src    https://your-font-host.example;
DirectiveWhy
script-srcThe script tag, https://cdn.mawgood.ai/chat/v1.js. Not needed when you install from npm (the code is in your bundle).
connect-srcThe chat API and its Server-Sent Events fallback (https://mawgood.ai), the realtime socket (wss://rt.mawgood.ai), and file uploads, which go straight to Mawgood's storage (Cloudflare R2).
img-srcYour bubble's images (the launcher image, the Mawgood's photo), files in the chat (short-lived links to R2), and previews of files the visitor picks (blob:). Catalog card photos come from wherever your catalog's images are hosted: add those hosts too, or use https:.
media-srcVoice notes and voice replies (R2), and the visitor's own recording (blob:).
style-srcThe bubble adds its styles in its own Shadow DOM with a <style> element.
font-srcOnly when the look sets shape.font.webFontUrl: the host of that font file. With the default system font, leave it out.

About the R2 host. Files aren't served from a public bucket: uploads and file links are short-lived signed URLs on Mawgood's storage account's S3 endpoint, https://<account-id>.r2.cloudflarestorage.com. Its exact host isn't published here, so the lines above use the wildcard. To narrow it, copy the host from any file link in your bubble (it's the same for every file) and use it instead of *.r2.cloudflarestorage.com.

For staging, use staging.mawgood.ai and wss://rt-staging.mawgood.ai instead.

Privacy

The bubble shows a one-line privacy notice, linked to the privacy page set on the card, before the first message. The device id lives in first-party storage only (localStorage on web, secure storage in apps): no cookies, no tracking. A device isn't a contact until its customer writes. Deleting a contact deletes its chats.

On this page