# Code to Add Support Chat Widget (Alternative to Intercom)

**URL:** <https://forums.knack.com/t/code-to-add-support-chat-widget-alternative-to-intercom/8767>\
**Category:** API & Custom Code\
**Created:** [August 13, 2020, 8:30am UTC](https://forums.knack.com/t/code-to-add-support-chat-widget-alternative-to-intercom/8767 "2020-08-13T08:30:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simonm](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@Simonm](https://forums.knack.com/u/Simonm)\
**Post date:** [August 13, 2020, 8:30am UTC](https://forums.knack.com/t/code-to-add-support-chat-widget-alternative-to-intercom/8767/1 "2020-08-13T08:30:25Z")

</div>

Hi everyone,

&nbsp;

I find crisp chat widget as alternative solution to intercom and its starter plan is free, it has magic browser which allows you to remotely see which pages are being viewed by your visitors. You also get ability to run your own knowledge base of your app.

&nbsp;

All you need is to paste the following code into your API /&nbsp; Javascript section of your app. Remember to sign up with here&nbsp;[Crisp &nbsp;](https://crisp.chat/en/)in order to obtain your website ID key.

You need to add your own Crisp website ID.

&nbsp;

// Script to add Crisp Chat widget to Knack Application//

window.$crisp=[];window.CRISP\_WEBSITE\_ID="YOUR OWN WEBSITE ID";  
(function(){d=document;  
s=d.createElement("script");  
s.src="[https://client.crisp.chat/l.js](https://client.crisp.chat/l.js)";  
s.async=1;d.getElementsByTagName("head")[0]  
.appendChild(s);})();

&nbsp;

Enjoy!

---

<div class="post-metadata">

**Author:** ![Simonm](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@Simonm](https://forums.knack.com/u/Simonm)\
**Post date:** [April 12, 2021, 9:28am UTC](https://forums.knack.com/t/code-to-add-support-chat-widget-alternative-to-intercom/8767/2 "2021-04-12T09:28:09Z")

</div>

Thank you very much Julian, and I really appreciate your input herein.

Can anyone perhaps help me out to reveal&nbsp;the logged in users when you using embedded widget which sits inside knack pages and not&nbsp; the inline widget (which appears at the bottom corner of the page). Here below is my code for the embbeded widget which I was get users names / information:

\<div id='tawk\_6038a7d2385de407571a4366'\>\</div\>  
\<!--Start of Tawk.to Script--\>  
\<script type="text/javascript"\>  
var Tawk\_API=Tawk\_API||{}, Tawk\_LoadStart=new Date(); Tawk\_API.embedded='tawk\_33333334366';  
(function(){  
var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];  
s1.async=true;  
s1.src='[https://embed.tawk.to/########33/1f32lnvrp](https://embed.tawk.to/6038a7d2385de407571a4366/1f32lnvrp)';  
s1.charset='UTF-8';  
s1.setAttribute('crossorigin','\*');  
s0.parentNode.insertBefore(s1,s0);})();  
\</script\>  
\<!--End of Tawk.to Script--\>

&nbsp;

Thank you very much

---

<div class="post-metadata">

**Author:** ![JulianKirkness](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/juliankirkness/32/770_2.png) [@JulianKirkness](https://forums.knack.com/u/JulianKirkness)\
**Post date:** [March 2, 2021, 12:55pm UTC](https://forums.knack.com/t/code-to-add-support-chat-widget-alternative-to-intercom/8767/3 "2021-03-02T12:55:08Z")

</div>

I have one small thing to add to this...  
  
I have a client in Ireland who have a lot of users with a ' in their names and this causes this tawk.to code to fail - to get round this I have added:

var originalName = Knack.getUserAttributes().name;   
var cleanName = originalName.replace("'", " ");  
TawkData = "var Tawk\_API=Tawk\_API||{}; Tawk\_API.visitor = { name : '" + cleanName + "', email : '" + Knack.getUserAttributes().email + "'};";

---

<div class="post-metadata">

**Author:** ![BradStevens](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/bradstevens/32/140_2.png) [@BradStevens](https://forums.knack.com/u/BradStevens)\
**Post date:** [October 2, 2020, 8:23pm UTC](https://forums.knack.com/t/code-to-add-support-chat-widget-alternative-to-intercom/8767/4 "2020-10-02T20:23:24Z")

</div>

Thanks Sam & Bruno!

And Bruno your code reveals how to initiate Tawk.to with the logged in user's details which is awesome.

---

<div class="post-metadata">

**Author:** ![BRUNOCERQU60563](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/brunocerqu60563/32/162_2.png) [@BRUNOCERQU60563](https://forums.knack.com/u/BRUNOCERQU60563)\
**Post date:** [September 30, 2020, 12:19am UTC](https://forums.knack.com/t/code-to-add-support-chat-widget-alternative-to-intercom/8767/5 "2020-09-30T00:19:32Z")

</div>

Hey Sam,

Nice option there.

You can also use Tawk.to, also free, just set up your account with them, configure a widget with your colors and style, get the code and place this on your JS:

TawkData = "var Tawk\_API=Tawk\_API||{}; Tawk\_API.visitor = { name : '" + Knack.getUserAttributes().name + "', email : '" + Knack.getUserAttributes().email + "'};";
  

console.log('Loading Tawk.to Via Knack');
  

var tawk=document.createElement("script");

tawk.type="text/javascript";

tawk.innerHTML = TawkData;

$("head").append(tawk);
  

var s=document.createElement("script");

s.type="text/javascript";

s.src='[https://embed.tawk.to/YOUR-CODE-HERE/default](https://embed.tawk.to/YOUR-CODE-HERE/default)';

s.charset='UTF-8';

s.setAttribute('crossorigin','\*');

$("head").append(s);

&nbsp;

![](upload://iLADCs67EUbTrWjVimp8C89c23n.jpeg)

&nbsp;

![](upload://2tbw6SitoGs1acpJ83atkZxf4zt.jpeg)
