showToastPopup not working

I am attempting to create an Integration (client application) and I want to be able to have a popup message when we change our All Hands On Deck (AHOD) status. I am able to get everything to work except the the showToastPopup. Here is what I am working with:

    var myClientApp;
    var ahodHub;
    $(document).ready(initPage);
    function initPage() {
        myClientApp = new window.purecloud.apps.ClientApp();
        ahodHub = $.connection.aHODhub;
        ahodHub.client.setLevel = setLevel;
        $.connection.hub.start().done(function () {
            ahodHub.server.getAhodLevel();
        })
    }
    function setLevel(ahodLevel) {
        var options = { type: 'error' };
        switch (ahodLevel.Level) {
            case 0:
                ahod0();
                break;
            case 1:
                ahod1();
                break;
            case 2:
                ahod2();
                break;
            case 3:
                ahod3();
                break;
            case 4:
                ahod4();
                break;
            case 5:
                ahod5();
                break;
        }
        myClientApp.alerting.showToastPopup("AHOD Change!!!", $("#ahodWords").html(), options);
    }

setLevel is called by websockets when the AHOD level changes. #ahodWords is a div that holds the current status defined by one of the ahod# Functions. I even tried to create a toast in the console and it didn't work.

thanks ahead of time

Hello,

When using type 'error', the Genesys Cloud client requires the showCloseButton to be enabled.

var options = { type: 'error', showCloseButton: true };

Regards,

I have tried both of theses and neither work:

 myClientApp.alerting.showToastPopup("test","test", { type: 'error', showCloseButton: true });
 myClientApp.alerting.showToastPopup("test","test");

I have tried it - using the toast example listed on dev center and it worked for me.
Setting the following as my Client App integration Application URL: https://mypurecloud.github.io/client-app-sdk/toast.html?pcEnvironment={{pcEnvironment}}&pcLangTag={{pcLangTag}}

Regards,

1 Like

This is the line that was causing the issues. In the toast.html, it was assigning the pcEnvironment with the creation of ClientApp("pcEnvironment");

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.