Usage

Embed the script into the body of your page and specify the path to your configuration file via data-config:src attribute or provide fallback configuration options using data-config:fallback:<config-item-name> attributes. The id="cm-chat-script" is mandatory. Query parameters (e.g. ?v=123) might be used for cache busting.

<body>
  ...
  <script
    id="cm-chat-script"
    src="https://cm.com/embeddable-chat-button/cm-chat.min.js?v=123"
    data-config:src="<path-to-your-website>/config.json"
    data-config:fallback:chat.applebusinesschat.businessid="00000000-0000-0000-0000-000000000000"
    data-config:fallback:chat.whatsapp.phone="31000000000"
    type="text/javascript"
  ></script>
</body>

Config options

NB: All config options can be specified using data-config:fallback:... attributes as plain-text strings. To embed html blocks (e.g. to render an <a href=... link under the QR Code) you have to provide a configuration file.

Config file example

{
  "chat.applebusinesschat.businessid": "00000000-0000-0000-0000-000000000000",
  "chat.applebusinesschat.tooltip": "Apple Business Chat",
  "chat.whatsapp.phone": "31000000000",
  "chat.whatsapp.subtitle": "Scan & chat",
  "chat.whatsapp.tagline": {
    "html": "Scan the code with your mobile phone to start chatting. Or use <a href=\"https://api.whatsapp.com/send?phone=31000000000\" target=\"_blank\">WhatsApp Web</a>"
  },
  "chat.whatsapp.title": "WhatsApp",
  "chat.whatsapp.tooltip": "WhatsApp"
}