SDKs overview

Intercom provides Software Development Kits (SDKs) to enable developers to integrate the Intercom Messenger and other features directly into their web and mobile applications. These SDKs abstract much of the complexity of interacting with the Intercom API, offering methods for user identification, attribute setting, event tracking, and displaying the Messenger UI. By using an SDK, developers can embed Intercom's customer engagement capabilities, such as live chat, product tours, and targeted messages, into their user experience.

The official SDKs are designed to provide robust and secure communication with the Intercom platform. They handle tasks such as authentication, data serialization, and network requests, allowing developers to focus on the application-specific logic. Beyond the official offerings, a community of developers has contributed additional libraries for various programming languages and frameworks, extending Intercom's reach and flexibility for integration Intercom integration guides. These community-driven projects often address niche use cases or provide wrappers for languages not directly supported by official SDKs, though their maintenance and support levels can vary.

Official SDKs by language

Intercom maintains official SDKs for key platforms to facilitate direct integration of its services into client-side applications. These SDKs are actively developed and supported by Intercom, ensuring compatibility with the latest features and platform updates. Each SDK is tailored to its respective environment, offering idiomatic interfaces and handling platform-specific considerations for optimal performance and user experience.

The following table outlines the primary official SDKs provided by Intercom:

Language/Platform Package/Module Install Command (Example) Maturity
JavaScript intercom-js (via snippet) <script>window.intercomSettings = { app_id: 'YOUR_APP_ID' };</script><script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_stub');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/YOUR_APP_ID';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);};if(document.readyState==='complete'){l();}else if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})(); Stable
React Native @intercom/intercom-react-native npm install @intercom/intercom-react-native or yarn add @intercom/intercom-react-native Stable
iOS Intercom (CocoaPods) pod 'Intercom' Stable
Android io.intercom.android:intercom-sdk (Gradle) implementation 'io.intercom.android:intercom-sdk:latest.release' Stable

These official SDKs are the recommended approach for integrating Intercom into applications built on their respective platforms, offering comprehensive features and ongoing support.

Installation

Installation methods vary depending on the target platform and development environment. The following sections provide general guidance and examples for setting up Intercom's official SDKs.

JavaScript (Web)

For web applications, the Intercom Messenger is typically installed by embedding a JavaScript snippet directly into the HTML of the web page. This snippet asynchronously loads the Intercom script and initializes the Messenger. The app_id is unique to each Intercom workspace and connects the widget to the correct backend service.

To install the JavaScript SDK, place the provided snippet just before the closing </body> tag of your website Intercom JavaScript installation guide:

<script>
  window.intercomSettings = {
    app_id: "YOUR_APP_ID"
  };
</script>
<script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_stub');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/YOUR_APP_ID';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);};if(document.readyState==='complete'){l();}else if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();</script>

Replace YOUR_APP_ID with your actual Intercom application ID.

React Native

The Intercom React Native SDK allows integration into both iOS and Android applications from a single codebase. It requires installation via a package manager and then linking to native modules.

First, install the package using npm or yarn:

npm install @intercom/intercom-react-native
# or
yarn add @intercom/intercom-react-native

After installation, follow the platform-specific linking instructions for iOS (CocoaPods) and Android (Gradle) as detailed in the official Intercom React Native documentation Intercom React Native SDK installation.

iOS

For native iOS applications, the Intercom SDK is typically installed using CocoaPods, a dependency manager for Objective-C and Swift projects.

Add the following line to your Podfile:

pod 'Intercom'
# Then run:
pod install

After installing, you will need to initialize Intercom in your AppDelegate, typically within the application:didFinishLaunchingWithOptions: method, using your appId and apiKey Intercom iOS SDK setup guide.

Android

For native Android applications, the Intercom SDK is integrated as a Gradle dependency.

Add the following to your app's build.gradle file:

dependencies {
    implementation 'io.intercom.android:intercom-sdk:latest.release'
}

// Also ensure your project-level build.gradle includes Maven Central or JCenter
allprojects {
    repositories {
        google()
        mavenCentral() // or jcenter()
    }
}

Initialize Intercom in your application's Application class or main activity, providing your appId and apiKey Intercom Android SDK installation.

Quickstart example

This quickstart example demonstrates how to initialize Intercom and identify a user using the JavaScript SDK. Identifying users is crucial for personalizing interactions and tracking their activity within Intercom.

After embedding the Intercom snippet in your web page, you can interact with the Intercom object globally. The most common first step after the initial setup is to identify the current user. This allows Intercom to associate conversations, events, and attributes with a specific customer.

To identify a user, you would typically call Intercom('boot', settings) with user-specific data. If a user is already booted, you can use Intercom('update', settings) to change their attributes or update their identity without triggering a new session.

JavaScript (Web) User Identification

This example demonstrates booting Intercom for a logged-in user with specific attributes. The user_id or email is essential for identifying unique users.

// Assuming Intercom snippet is already loaded

// Boot Intercom for a logged-in user
Intercom('boot', {
  app_id: "YOUR_APP_ID",
  user_id: "customer_12345", // Unique identifier for your user
  email: "[email protected]",
  name: "John Doe",
  created_at: 1678886400, // Unix timestamp for when the user signed up
  company: {
    id: "company_abc",
    name: "Example Corp",
    plan: "Premium"
  },
  // Custom attributes can also be sent
  custom_attribute_1: "value_1",
  last_seen_page: window.location.pathname
});

// To update user attributes after initial boot
// For example, if the user changes their name or enters new data
function updateUserName(newName) {
  Intercom('update', {
    name: newName
  });
  console.log('Intercom user name updated to:', newName);
}

// To track an event
function trackProductView(productName) {
  Intercom('trackEvent', 'product_viewed', {
    product_name: productName,
    category: 'electronics'
  });
  console.log('Intercom event tracked: product_viewed for', productName);
}

// To show the Messenger
function openIntercomMessenger() {
  Intercom('show');
  console.log('Intercom Messenger shown.');
}

// To hide the Messenger
function closeIntercomMessenger() {
  Intercom('hide');
  console.log('Intercom Messenger hidden.');
}

// Logout a user (important for security and correct user identification)
function logoutUser() {
  Intercom('shutdown'); // Clears the current user's session
  console.log('Intercom user shut down.');
}

This example demonstrates the core functionalities of booting, updating, tracking events, and managing the Messenger visibility. For details on all available methods and configurations, refer to the official Intercom Developer Docs Intercom API Reference.

Community libraries

While Intercom provides official SDKs for major platforms, the developer community has created additional libraries and wrappers for other languages and frameworks. These community-contributed projects can offer integrations for environments not directly supported by Intercom, or they might provide alternative approaches to using the official API.

It is important to note that community libraries are not officially maintained or supported by Intercom. Their quality, features, documentation, and ongoing maintenance can vary significantly. Developers using community libraries should evaluate them based on factors such as:

  • Active Maintenance: Is the library regularly updated to support new Intercom features or address breaking changes in the Intercom API?
  • Documentation: Is the documentation clear, comprehensive, and up-to-date?
  • Community Support: Is there an active community (e.g., GitHub issues, forums) that can provide assistance?
  • Security: Has the library undergone any security audits, especially if it handles sensitive user data or authentication?
  • Feature Completeness: Does the library expose all necessary Intercom API endpoints or SDK functionalities required for the intended use case?

Examples of areas where community libraries might be found include:

  • Backend API Wrappers: Libraries for languages like Ruby, Python, Node.js, PHP, Go, and Java that interact with Intercom's REST API Intercom REST API. While Intercom's API is RESTful and can be consumed directly, wrappers simplify object serialization, error handling, and authentication.
  • Framework-Specific Integrations: Libraries or plugins designed for specific web frameworks (e.g., Django, Ruby on Rails) that streamline the integration process within those ecosystems.
  • Unofficial Mobile Wrappers: Sometimes, community members create wrappers for mobile platforms or cross-platform frameworks not covered by official SDKs, though these are less common due to Intercom's strong official mobile support.

To find community libraries, developers typically search platforms like GitHub, npm (for JavaScript/Node.js), or package repositories specific to their programming language. Always verify the source and reputation of any third-party library before integrating it into a production environment.

For example, while Intercom lists primary language examples for its REST API, these are not client-side SDKs but rather server-side integrations Intercom API integration options:

  • Ruby
  • Python
  • Node.js
  • PHP
  • Go
  • Java

These server-side integrations are used for managing users, conversations, and data through the Intercom API from a backend system, rather than embedding the Messenger directly into a client application.