Tutorial: ada

ada

Ada Chat Bot

How to Install

  1. Go to Portal’s Control Panel, Tags Manager;
  2. Click “Create Tag” and select “Custom JS”;
  3. Give it a name (e.g. “Ada”), give a description;
  4. Assign a “On App Init” condition to this tag
  5. Insert the following contents of the Tag:
(async () => {
    function init() {
        async function onScriptLoad() {
            const response = await Playtech.API.server.getJWTToken();

            window.adaSettings = {
                sensitiveMetaFields: {
                    jwt_token: response?.data?.jwtToken ?? '',
                },
                zdChatterAuthCallback: (callback) => {
                    (async () => {
                        const response = await Playtech.API.server.getJWTToken();

                        callback(response?.data?.jwtToken ?? '');
                    })();
                }
            };
        }

        const script = document.createElement('script');

        script.id = '__ada';
        script.type = 'text/javascript';
        script.onload = onScriptLoad;
        script.async = true;
        script.setAttribute('data-handle', '<YOUR HANDLE>');
        script.src = 'https://static.ada.support/embed2.js';

        document.getElementsByTagName('head')[0].appendChild(script);
    }


    if (Playtech.API.auth.isLoggedIn) {
        init();
    }

    Playtech.on(Playtech.Events.LOGGED_IN, init);
    Playtech.on(Playtech.Events.LOGGED_OUT, function () {
        window.adaEmbed?.reset();
    });
})();