> ## Documentation Index
> Fetch the complete documentation index at: https://forest-chore-open-api.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Intercom

Configuring the Intercom integration allows you to display your user’s session data (location, browser type, …) and conversations.

<Warning>
  In order for your intercom integration to work properly, you will have to use the version 2 of intercom API. To do so, you'll need go to the intercom developer hub and ensure that the app registered to retrieve your API key uses the intercom API version 2.0.
</Warning>

<img src="https://mintcdn.com/forest-chore-open-api/l9oWVTFSA2iV8NAX/images/legacy/javascript-agents/image%20(352).png?fit=max&auto=format&n=l9oWVTFSA2iV8NAX&q=85&s=b55b899bffc5bb85a6450dc9f7aa35d6" alt="" width="813" height="672" data-path="images/legacy/javascript-agents/image (352).png" />

First, add the intercom client as a dependency to your project:

<Tabs>
  <Tab title="SQL">
    ```bash theme={null}
    npm install intercom-client@2.11
    ```
  </Tab>

  <Tab title="Mongoose">
    ```
    npm install intercom-client@2.11
    ```
  </Tab>

  <Tab title="Rails">
    ```ruby theme={null}
    gem 'intercom'
    ```
  </Tab>
</Tabs>

Then, you need to add the intercom integration:

<Tabs>
  <Tab title="SQL">
    ```javascript theme={null}
    ...
    const intercomClient = require('intercom-client');
    const { objectMapping, connections } = require('../models');

    module.exports = async function (app) {
      app.use(await Liana.init({
        configDir: path.join(__dirname, '../forest'),
        envSecret: process.env.FOREST_ENV_SECRET,
        authSecret: process.env.FOREST_AUTH_SECRET,
        objectMapping,
        connections,
        integrations: {
          intercom: {
            accessToken: process.env.INTERCOM_ACCESS_TOKEN,
            intercom: intercomClient,
            mapping: ['users.email'],
          },
        },
      }));

      console.log(chalk.cyan('Your admin panel is available here: https://app.forestadmin.com/projects'));
    };
    ```
  </Tab>

  <Tab title="Mongoose">
    ```javascript theme={null}
    ...
    const intercomClient = require('intercom-client');
    const { objectMapping, connections } = require('../models');

    module.exports = async function (app) {
      app.use(await Liana.init({
        configDir: path.join(__dirname, '../forest'),
        envSecret: process.env.FOREST_ENV_SECRET,
        authSecret: process.env.FOREST_AUTH_SECRET,
        objectMapping,
        connections,
        integrations: {
          intercom: {
            accessToken: process.env.INTERCOM_ACCESS_TOKEN,
            intercom: intercomClient,
            mapping: ['users.email'],
          },
        },
      }));

      console.log(chalk.cyan('Your admin panel is available here: https://app.forestadmin.com/projects'));
    };
    ```
  </Tab>

  <Tab title="Rails">
    ```ruby theme={null}
    ForestLiana.integrations = {
      # ...
      intercom: {
        access_token: ENV['INTERCOM_ACCESS_TOKEN'],
        mapping: ['Customer']
      }
    }
    ```
  </Tab>
</Tabs>

* `intercom` is used to pass the intercom client version. To do so, you have to require the previously installed client, as in the example.
* `accessToken` should be defined in your environment variable and is provided by intercom.
* `mapping` refers to the collection and field name you want to map to intercom data. It can either be a field that contain emails that refer to intercom users or a field that contain ids mapping the `external_id` in Intercom API.

<Info>
  You will have to restart your server to see Intercom plugged to your project.
</Info>

<img src="https://mintcdn.com/forest-chore-open-api/l9oWVTFSA2iV8NAX/images/legacy/javascript-agents/image%20(353).png?fit=max&auto=format&n=l9oWVTFSA2iV8NAX&q=85&s=f300d29ffb9950652742eebdd6ed85b1" alt="" width="892" height="621" data-path="images/legacy/javascript-agents/image (353).png" />

### Others
