Zendesk

How to merge Blinger widget with Zendesk live-chat?

Step 1. Place the following code before the closing tag </body>:

<!-- Zendesk widget source -->
<script id="ze-snippet" src="https://static.zdassets.com/ekr/snippet.js?key=[your_zendesk_key]"> </script>

<!-- Init and customize Freshchat widget -->
<script>
    window.zESettings = {
        webWidget: {
            offset: {
                horizontal: '100px'
            },
        },
    };

    zE('webWidget:on', 'close', function() {
        zE('webWidget', 'hide');
    });
</script>

<!-- Init and customize Blinger Widget -->
<script>
    var showBlinger = function () {
        if (typeof Blinger !== 'undefined' && !Blinger.launcherWidget.isOpen) {
            document.getElementById('blinger-launcher-iframe').style.display = 'block';
        }
    };

    window['blingerBeforeRender'] = function () {
        var channel = new Blinger.Channels.SimpleActionChannel();
        channel.tooltip = 'Livechat';
        channel.color = '#75b145';
        channel.imageUrl = 'https://app.blinger.io/images/widget2/livechat.png';
        channel.action = function () {
            zE('webWidget', 'show');
            zE('webWidget', 'open');
        };

        Blinger.channelsWidget.addChannel(channel);
        Blinger.channelsWidget.resizeEnabled = true;
    };

    window['blingerInit'] = function () {
        document.getElementById('blinger-launcher-iframe').style.display = 'none';
    };

    var count = 0;
    var waitForZEWidgetloading = function () {
        var zEwidgetDisplay = zE('webWidget:get', 'display');

        if (zEwidgetDisplay === 'launcher') {
            var element = document.getElementById("launcher");
            element.parentNode.removeChild(element);
            showBlinger();
        } else {
            if (count < 20) {
                setTimeout(function () {
                    waitForZEWidgetloading();
                }, 300);
                count++;
            }
        }
    };

    waitForZEWidgetloading();

    (function (d) {
        var s = d.createElement("script");
        s.async = true;
        s.charset = "utf-8";
        s.src = "https://app.blinger.io/uploads/widgets2/[Value].js";
        d.head.appendChild(s);
    })(window.document);
</script>

Step 2. Insert widget's token from your Zendesk admin instead of [your_zendesk_key].

<script id="ze-snippet" src="https://static.zdassets.com/ekr/snippet.js?key=[your_zendesk_key]"> </script>

You can find widget's token in: Admin > Widget > "Setup" tab Token value goes after "key="

Step 3. Define the necessary number of the widget instead of [Value].

 s.src = "https://app.blinger.io/uploads/widgets2/[Value].js"

You can find the number of the widget you need after the value "Widget #", if you login to the administrator's account in Blinger and proceed to Widget module

Useful!

The color and caption of Zendesk online-chat button can be defined using parameters channel.tooltip = 'Online chat' and channel.color = '#75b145'accordingly.

Last updated