Integration: Intercom Chat

Article author
Josh Lopez
  • Updated

You can use the front-end API and the following code to automatically identify members on your site.

The following code has been adapted from this Intercom article.

 

Automatically identify logged-in members

<script>
MemberStack.onReady.then(function(member){
window.intercomSettings = {
app_id: "APP_ID",
name: member["name"],
email: member["email"],
};
})
</script>

 

Here's the page in Intercom where you add JavaScript code — Intercom pre-populates your workspace ID (this appears as your App_ID in the code) for you.

  1. Paste the code right before the closing body tag on every page of your website.

  2. We've edited the code to pre-populate the member's name & email address.

  3. IMPORTANT: If you copy the code snippet above, make sure to manually change your workspace ID (this is called your APP_ID in the code).

 

Display Intercom for logged in users only

<script>
MemberStack.onReady.then(function (member) {
if (member.loggedIn) {
window.intercomSettings = {
app_id: "YOURAPPIDHERE",
name: member["name"],
email: member["email"],
};
} else {
// member not logged in
}
});
</script>

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.