Add Live Chat to SharePoint

In this article we're going to show you how you can add Live Chat for Microsoft Teams to a SharePoint Modern Communication site.  Typically SharePoint does not allow you to add javascript code snippets to your website and disables scripting in general SharePoint sites.  We'll show you how to extend your SharePoint communication site to allow inline javascript code snippets.

First, you can use the SharePoint Framework (SPfx) to extend your SharePoint pages with a Modern Script Editor web part.  This web part enables embedding of a JavaScript code snippet into your pages.  We aren't going to cover this step here, but there is a good guide on GitHub:

Once you have cloned and packaged the Script Editor web part using Node package manager, you can deploy the script editor to your SharePoint site with the app catalog.

SharePoint Script Editor web part

Now, click the 'Edit markup' button to customize your web part.

SharePoint Modern Script Editor

Finally, include your Live Chat code snippet.  If you haven't yet signed up for a Live Chat free trial, you can set it up here.  Once you've added the code snippet to your web part, you see the live chat icon available on your SharePoint communication site!