Embed the widget

Host apps load chatyme.js once, then call two methods. Configuration is passed only through init() — no data-* attributes.

const script = document.createElement("script");
script.src = "{CHATYME_CLIENT_APP_URL}/chatyme.js";
script.onload = () => {
  window.Chatyme.init({
    client_app_url: "{CHATYME_CLIENT_APP_URL}",
    chat_app_url: "{CHATYME_CHAT_APP_URL}",
    chat_overlay: "client",
    config: {
      screen_type: "client",
      bot_id: "decathlon",
      language: "en",
      locale: "en-US",
      file_upload_path: "/files",
      user: {
        name: "Ada",
        surname: "Lovelace",
        email: "ada@example.com",
        role: "client",
        external_user_id: "42"
      },
      session: { client_profile_url: "" }
    },
    env: { EXTERNAL_API_TOKEN: "<jwt>" }
  });
};
document.body.appendChild(script);

// logout / unmount
window.Chatyme.destroy();

init

Mounts the widget after the script has loaded. Safe to call again after destroy(). Must not throw.

destroy

Removes Chatyme UI, listeners, and session state. Idempotent — safe when it was never initialized.

bot_id must match the licensed tenant. Widget token and agent login fail with 403 when the firm license is suspended or expired.
Developers · Chatyme