How can we help you today?

How to Add a Chat Widget Through ShortPoint Theme Builder

Communicating with your SharePoint site users has become easier through chat widgets. ShortPoint has made it possible to incorporate these functionalities in your SharePoint Modern site through Theme Builder. Adding a chat widget through Theme Builder will show it across your entire SharePoint site collection.


This article will provide a step-by-step guide on how to do this.


NOTEYou can use any chat widget you want. However, for this guide, we will be using Freshworks as an example.


sample chat widget


TABLE OF CONTENTS


Prerequisites


Interactive Tutorial


Before proceeding, you must already have the embed code of your chat widget. In the case of Freshworks, we will be using the code below. Just replace WEB_CHAT_TOKEN with your own. To get it, check out Freshchat web messenger.


function initFreshChat() {

    window.fcWidget.init({

        token: "WEB_CHAT_TOKEN",

        host: "https://wchat.freshchat.com"

    });

}

function initialize(i, t) {
    var e;
    i.getElementById(t) ? initFreshChat() : ((e = i.createElement("script")).id = t, e.async = !0, e.src = "https://wchat.freshchat.com/js/widget.js", e.onload = initFreshChat, i.head.appendChild(e))
}

function initiateCall() {
    initialize(document, "freshchat-js-sdk")
}
window.addEventListener ? window.addEventListener("load", initiateCall, !1) : window.attachEvent("load", initiateCall, !1);
NOTEAdding a chat widget through Theme Builder will show it across your entire SharePoint site collection. If you want to add the chat widget on a single SharePoint page, check out How to Embed a Chat Widget Using the ShortPoint Code Design Element.

Step-by-step Tutorial

Follow the detailed guide below:


Step 1: Open Theme Builder

  • Go to the SharePoint site you want to use and click the ShortPoint icon:


ShortPoint icon

  • Select Theme Builder:


Theme Builder


Step 2: Copy the Code

  • Copy the embed code of your chat widget. In the case of Freshworks, we will be using the code below. Just replace WEB_CHAT_TOKEN with your own. To get it, check out Freshchat web messenger.


function initFreshChat() {

    window.fcWidget.init({

        token: "WEB_CHAT_TOKEN",

        host: "https://wchat.freshchat.com"

    });

}

function initialize(i, t) {
    var e;
    i.getElementById(t) ? initFreshChat() : ((e = i.createElement("script")).id = t, e.async = !0, e.src = "https://wchat.freshchat.com/js/widget.js", e.onload = initFreshChat, i.head.appendChild(e))
}

function initiateCall() {
    initialize(document, "freshchat-js-sdk")
}
window.addEventListener ? window.addEventListener("load", initiateCall, !1) : window.attachEvent("load", initiateCall, !1);

Step 3: Paste Code

  • Go to Utilities:


Utilities

  • Select Custom JavaScript:


Custom JavaScript

  • Paste the code in the field provided:


paste code

  • Click Apply:


Apply

  • Publish your changes.


Congratulations! You now know how to add a chat widget using ShortPoint Theme Builder.


sample chat widget


Authorizing External Scripts


Since you will be loading JavaScript from external sources, you must add the source domain (in our case,  https://wchat.freshchat.com/js/widget.js) to the Trusted Script Sources list in your SharePoint Admin Center. This step is required to ensure the script runs correctly under SharePoint's Content Security Policy (CSP).



For detailed instructions, please follow the "How to Add Trusted Source URLs" section in our Managing Trusted Script Sources for JavaScript Customizations in ShortPoint article.


Related articles:

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.

World's best intranet sites are designed using ShortPoint

Get started today! Learn more
See all 15 topics

Start a trial

Ignite your vision. Install ShortPoint directly on your site, or play in sandbox mode. No credit card required.

Get started today

World’s best intranet sites are designed using ShortPoint

Thousands of companies using ShortPoint everyday to design, brand and build award winning intranet sites.

Get started Learn more