Developer Javascript API

We have a simple yet powerful Javascript API and custom CSS support that gives you broad flexibility on how your app behaves.

Developing with Social Intents

Give it a shot! All you need to do is ensure you have the Social Intents generated code snippet or plugin installed on your page. Once you have that, you can use any of the methods defined below.

onSIApiReady()

This callback method is used to notify your page when the Social Intents API script has finished loading. Since we load our scripts asynchronously, you can wrap your initialization logic in this method

    <script type="text/javascript">
    function onSIApiReady() 
    {
    //Will display the tab once the scripts have loaded
    SI_API.showTab();
    };
    </script>

SI_API.showInvite(message)

This method is used to display the proactive chat invite with a custom message. Use this to create custom invite messages for each page of your site. It's a great way to increase conversions.

    <script type="text/javascript">
    function onSIApiReady() 
    {
    //Will display the tab once the scripts have loaded
    SI_API.showInvite('Questions about our products? I can help!');
    };
    </script>

SI_API.setChatInfo(name,email,phone,group,question)

This method is used to prepopulate pre-sales chat info. For instance, if you a member site and have already collected email and name, you can pre-populate these fields on the chat. If you don't want the visitor to change them, simply disable these fields in your settings, and we'll automatically place this information in the chat.

    <script type="text/javascript">
    function onSIApiReady() 
    {
    //Will display the tab once the scripts have loaded
    SI_API.setChatInfo('visitor name','email@test.com','(123) 123-1234',
    'Marketing','I have a question about your products');
    };
    </script>

SI_API.showPopup()

This method is used to display the chat window or popup on your page. Have more complex rules on how you want to display your app? Here's where you can do it.

    <script type="text/javascript">
    SI_API.showPopup();
    </script>

SI_API.hidePopup()

This method is used to hide the popup on your page. Want to automatically close the popup after a period of time, here's your method.

    <script type="text/javascript">
    SI_API.hidePopup();
    </script>

SI_API.showTab()

This method is used to show the Tab button on your page. For example, you can display it after a custom period of time, or after a click on a certain element on your page.

    <script type="text/javascript">
    function onSIApiReady() 
    {
    //Will display the tab once the scripts have loaded
    SI_API.showTab();
    };
    </script>

SI_API.hideTab()

This method is used to hide the Tab button on your page.

    <script type="text/javascript">
    SI_API.hideTab();
    </script>

SI_API.addParams()

Add custom parameters to each chat request to display on the chat invite. Send customer information, order numbers, or any other details as key value pairs.

    <script type="text/javascript">
    function onSIApiReady() 
    {
        var params = [];
        params.push({name:'Member ID',value:'abc'}); 
        params.push({name:'Order Number',value:'1000'}); 

        SI_API.addParams(params);

    };
    </script>

SI_API.onChatOpened()

This callback method is triggered when the chat button is clicked and the chat window appears.

    <script type="text/javascript">
    function onSIApiReady() 
    {
        //Will trigger when chat window appears
        SI_API.onChatOpened = function()
        {
            alert("chat opened");
        };
    };
    </script>

SI_API.onChatClosed()

This callback method is triggered when the chat window is minimized.

    <script type="text/javascript">
    function onSIApiReady() 
    {
        //Will trigger when chat window is minimized
        SI_API.onChatClosed = function()
        {
            alert("chat closed");
        };
    };
    </script>

SI_API.onChatEnded()

This callback method is triggered when an active chat is ended.

    <script type="text/javascript">
    function onSIApiReady() 
    {
        //Will trigger when chat window is minimized
        SI_API.onChatEnded = function()
        {
            alert("chat ended");
        };
    };
    </script>