How to install chat widgets on serverless web apps (thread)
I recently did this for a client with a @webflow site using @MemberstackApp accounts and @intercom.

The same steps apply if you're using another chat widget, like @helpscout, or another hosted site service, like @squarespace, or DIY.

I'll walkthrough for Intercom & HelpScout ➡
(1) - Install the chat widget.

For @helpscout, slap their provided snippet in the custom code section of your Webflow site.

For @intercom, two steps:

1. Install #GoogleTagManager on Webflow - webflow.com/blog/integrati…

2. Install Intercom with GTM -
intercom.com/help/en/articl…
If you're installing @intercom - create a symbol in Webflow that contains your GTM embed so you can easily add it before the <body> tag on each page.
(2) Identify logged-in users

If the chat widget is just for anonymous visitors, you're good to go. If the site has user accounts, however, you'll want to identify these visitors. This lets you prefill their name, email, and display prior conversations.
To do this, both @intercom and @helpscout provide a secret key. You need to provide an endpoint that uses this key to hash a user's email and return a signature. Like the bouncer at a club, the endpoint checks IDs to make sure your visitors aren't being impersonated.
But this is a server-LESS web app, so we have nowhere to create an endpoint, and I didn't want to stand-up a server just for this.

Cue @Netlify 's Functions -- toss your secret key in the build environment, export a function like this, and you have a live endpoint. Image
With the endpoint in place, we need to call it when the user logs in, and then pass the signature to the chat widget: Image
Rad - the widget now knows when your visitors are logged in. You'll want to reset the widget whenever they log out, so someone else using the device can't see their convos.

Calling `Intercom('shutdown')` or `Beacon('logout')` does the trick.
(3) Optionally, open the chat widgets from other elements on your page.

We wanted the side nav and a welcome card to open the chat widget when clicked. Both @intercom and @helpscout provide a simple API you can use to open the widget on clicks, scroll locations, events, etc. Image
Rather than adding custom code for each element, tag any desired element with a custom data attribute, like 'data-of=chat', and then add a click listener for any matching elements. This makes it easy to make changes in the future, and you avoid misplacing code embeds. ImageImage
That's it! DMs are open if you need help - we installed @helpscout / @intercom on a @webflow site and identified visitors using a #serverless endpoint from @Netlify.

More #code for #nocode and walkthroughs of problem-solving for clients coming soon 🤑

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with James Clements

James Clements Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(