Integrations

Integrations

Forest is able to leverage data from third party services by reconciliating it with your application’s data, providing it directly to your admin. All your admin actions can be performed at the same place, bringing additional intelligence to your admin and ensuring consistency.

This feature requires a Business plan or higher. However, it's free to try in non-production environments.

Stripe

Configuring the Stripe integration for Forest allows you to have your customer’s payments, invoices, cards and subscriptions (1) alongside the corresponding customer from your application. A Refund Smart Action (2,3) is also implemented out-of-the-box.

SQL
Mongodb

On our Live Demo, we’ve configured the Stripe integration on the customers collection. The Stripe Customer ID is already stored on the database under the field stripe_id.

app.js
// ...
app.use(require('forest-express-sequelize').init({
modelsDir: __dirname + '/models',
envSecret: process.env.FOREST_ENV_SECRET,
authSecret: process.env.FOREST_AUTH_SECRET,
sequelize: require('./models').sequelize,
integrations: {
stripe: {
apiKey: process.env.STRIPE_SECRET_KEY,
mapping: 'customers.stripe_id',
stripe: require('stripe')
}
}
}));
module.exports = app;

On our Live Demo, we’ve configured the Stripe integration on the customers collection. The Stripe Customer ID is already stored on the database under the field stripe_id.

app.js
// ...
app.use(require('forest-express-mongoose').init({
modelsDir: __dirname + '/models',
envSecret: process.env.FOREST_ENV_SECRET,
authSecret: process.env.FOREST_AUTH_SECRET,
mongoose: require('mongoose'),
integrations: {
stripe: {
apiKey: process.env.STRIPE_SECRET_KEY,
mapping: 'customers.stripe_id',
stripe: require('stripe')
}
}
}));
module.exports = app;

Available options

Here are the complete list of available options to customize your Stripe integration.

Name

Type

Description

api_key

string

The API Secret key of your Stripe account. Should normally starts with sk_.

mapping

string

Indicates how to reconcile your Customer data from your Stripe account and your collection/field from your database. Format must be model_name.stripe_customer_id_field

A stripe option is also available (except for Rails) to use the official Node.js Stripe library NPM package.

Mixpanel

The Mixpanel integration allows you to fetch Mixpanel’s events and display them at a record level into Forest.

SQL
Mongodb

To benefit from Mixpanel integration, you need to add the package mixpanel-data-export before going further.

Then, add the following code to your app.js file. In our example we will map the customers.email with the data coming from Mixpanel. You may replace by your own relevant collection(s).

By default, Mixpanel is sending the following fields: id, event, date, city, region, country, timezone, os, osVersion, browser, browserVersion. If you want to add other fields from Mixpanel, you have to add them in customProperties:

app.js
app.use(require('forest-express-sequelize').init({
modelsDir: __dirname + '/models',
envSecret: process.env.FOREST_ENV_SECRET,
authSecret: process.env.FOREST_AUTH_SECRET,
sequelize: require('./models').sequelize,
integrations: {
mixpanel: {
apiKey: process.env.MIXPANEL_API_KEY,
apiSecret: process.env.MIXPANEL_SECRET_KEY,
mapping: ['customers.email'],
customProperties: ['Campaign Source', 'plan', 'tutorial complete'],
mixpanel: require('mixpanel-data-export')
},
},
}));
module.exports = app;

To benefit from Mixpanel integration, you need to add the package mixpanel-data-export before going further.

Then, add the following code to your app.js file. In our example we will map the customers.email with the data coming from Mixpanel. You may replace by your own relevant collection(s).

By default, Mixpanel is sending the following fields: id, event, date, city, region, country, timezone, os, osVersion, browser, browserVersion. If you want to add other fields from Mixpanel, you have to add them in customProperties:

app.js
app.use(require('forest-express-mongoose').init({
modelsDir: __dirname + '/models',
envSecret: process.env.FOREST_ENV_SECRET,
authSecret: process.env.FOREST_AUTH_SECRET,
mongoose: require('mongoose'),
integrations: {
mixpanel: {
apiKey: process.env.MIXPANEL_API_KEY,
apiSecret: process.env.MIXPANEL_SECRET_KEY,
mapping: ['customers.email'],
customProperties: ['Campaign Source', 'plan', 'tutorial complete'],
mixpanel: require('mixpanel-data-export')
},
},
}));
module.exports = app;

You will then be able to see the Mixpanel events on a record, a Customer in our example.

Intercom

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

SQL
Mongodb

You have to add the Intercom integration in your app.js file, as described below. The mapping option is the collection on which your integration is pointing.

app.js
const intercomClient = require('intercom-client');
app.use(require('forest-express-sequelize').init({
// ...
integrations: {
intercom: {
accessToken: process.env.INTERCOM_ACCESS_TOKEN,
intercom: intercomClient,
mapping: ['Customer'],
},
},
});

You have to add the Intercom integration in your app.js file, as described below. The mapping option is the collection on which your integration is pointing.

app.js
const intercomClient = require('intercom-client');
app.use(require('forest-express-mongoose').init({
// ...
integrations: {
intercom: {
accessToken: process.env.INTERCOM_ACCESS_TOKEN,
intercom: intercomClient,
mapping: ['Customer'],
},
},
});

You will have to restart your server to see Intercom plugged to your project.