Skip to main content
The Intercom JavaScript API
Beth-Ann Sher avatar
Written by Beth-Ann Sher
Updated this week

To get more out of Intercom, you can use our JavaScript API to do all sorts of useful things, like tracking what your customers do and customizing how the Messenger appears for them. 

Important: If you’re looking for the actual code snippets from our JavaScript API, head over to our developer hub.  

Here are just some examples of what our JavaScript API lets you do:

Track events 

Events let you see when users take specific actions in your product, like when they use a feature or upgrade their subscription. Once you’ve set these up you can send the right messages to the right customers at the right time. 

Integrate a single page app  

If you have a single page app (characterized by very few page refreshes) you’ll need to integrate Intercom in a slightly different way. You need to use our API to to shut down the Messenger and restart it on each page. 

Clear a user’s session 

You’ll need to shut down Intercom to clear a user’s session when they log out of your app. This is a security measure that ensures users who share a computer and a browser won’t be able to view each other's conversations. 

Customize the Intercom Messenger 

You can customize how the Messenger appears for your users. For example, you can:

  • Choose to show or hide the launcher on specific pages. For example, if you’d like to provide VIP support for premium customers, you could show it for these users and hide it for everyone else. 

  • Show your users’ unread message count. Customers will see how many messages they’ve left to read, even if they dismiss your notifications. 

  • Pre-fill the Messenger with whatever content you like. For example, you could have a link appear when users open the Messenger. 

To see the full list of JavaScript API methods and to grab the code snippets, head over to our developer doc now.


Finding your Access Tokens


To locate the access tokens for your workspace, go to the Developer Hub and then navigate to Your Apps.


Here you'll find a list of all the apps you've built, including the workspace the app is installed on and the production workspace's access token.

To find the access token you'll need to locate the private app with the same name as your workspace's name. If this was migrated over during the update it will have the phrase "Access Token App" at the end of its name.

For example, my production workspace was called CSMappe and the access token would be this private app in my developer hub:

Once you've located this you'll want to click on the app's name. This will take you to the app's basic information view, like this 👇
​

Next, you'll want to locate your access-token details by clicking the Authentication link in the navigation bar.


Along with details regarding the scope of the token. (i.e. what data it can access and what it can do), you can also make updates to change the scope of your access token and more by clicking the Edit button, like you see below 👇

If you have any questions about the Authorization page for an app (access token scopes, OAuth, or their use) you can find a lot of detail in our documentation guide about them here.

Important: Our API paginates results with a max of 150 records per page (Link for more information). To go to the next page to iterate through all of your records you'll need to provide a page attribute. You can find out more about pagination here.


💡Tip

Need more help? Get support from our Community Forum
Find answers and get help from Intercom Support and Community Experts


Did this answer your question?