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 Starter plan or higher. However, it's free to try in non-production environments.
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.
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
.
middlewares/forestadmin.js...module.exports = function (app) {app.use(Liana.init({modelsDir: path.join(__dirname, '../models'),configDir: path.join(__dirname, '../forest'),envSecret: process.env.FOREST_ENV_SECRET,authSecret: process.env.FOREST_AUTH_SECRET,sequelize: models.Sequelize,integrations: {stripe: {apiKey: process.env.STRIPE_SECRET_KEY,mapping: 'customers.stripe_id',stripe: require('stripe')}}}));console.log(chalk.cyan('Your admin panel is available here: https://app.forestadmin.com/projects'));};
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
.
middlewares/forestadmin.js...module.exports = function (app) {app.use(Liana.init({modelsDir: path.join(__dirname, '../models'),configDir: path.join(__dirname, '../forest'),envSecret: process.env.FOREST_ENV_SECRET,authSecret: process.env.FOREST_AUTH_SECRET,mongoose,integrations: {stripe: {apiKey: process.env.STRIPE_SECRET_KEY,mapping: 'customers.stripe_id',stripe: require('stripe')}}}));console.log(chalk.cyan('Your admin panel is available here: https://app.forestadmin.com/projects'));};
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 |
mapping | string | Indicates how to reconcile your Customer data from your Stripe account and your collection/field from your database. Format must be |
A stripe
option is also available to use the official Node.js Stripe library NPM package.
The Mixpanel integration allows you to fetch Mixpanel’s events and display them at a record level into Forest.
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
:
middlewares/forestadmin.js...module.exports = function (app) {app.use(Liana.init({modelsDir: path.join(__dirname, '../models'),configDir: path.join(__dirname, '../forest'),envSecret: process.env.FOREST_ENV_SECRET,authSecret: process.env.FOREST_AUTH_SECRET,sequelize: 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')},},}));console.log(chalk.cyan('Your admin panel is available here: https://app.forestadmin.com/projects'));};
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
:
middlewares/forestadmin.js...module.exports = function (app) {app.use(Liana.init({modelsDir: path.join(__dirname, '../models'),configDir: path.join(__dirname, '../forest'),envSecret: process.env.FOREST_ENV_SECRET,authSecret: process.env.FOREST_AUTH_SECRET,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')},},}));console.log(chalk.cyan('Your admin panel is available here: https://app.forestadmin.com/projects'));};
You will then be able to see the Mixpanel events on a record, a Customer
in our example.
You'll need to install the Mixpanel Data Export package to run the Mixpanel integration.
Configuring the Intercom integration allows you to display your user’s session data (location, browser type, …) and conversations.
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.
First, add the intercom client as a dependency to your project (intercom client version needs to be 2.11
):
npm install intercom-client@2.11
Then, you need to add the intercom integration in the middlewares/forestadmin.js
file.
middlewares/forestadmin.js...const intercomClient = require('intercom-client');module.exports = async function (app) {app.use(await Liana.init({modelsDir: path.join(__dirname, '../models'),configDir: path.join(__dirname, '../forest'),envSecret: process.env.FOREST_ENV_SECRET,authSecret: process.env.FOREST_AUTH_SECRET,sequelize,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'));};
middlewares/forestadmin.js...const intercomClient = require('intercom-client');module.exports = async function (app) {app.use(await Liana.init({modelsDir: path.join(__dirname, '../models'),configDir: path.join(__dirname, '../forest'),envSecret: process.env.FOREST_ENV_SECRET,authSecret: process.env.FOREST_AUTH_SECRET,mongoose,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'));};
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.
You will have to restart your server to see Intercom plugged to your project.
As mentioned above, we natively support 3 integrations:
Intercom
Mixpanel
Stripe
However, basically any integration can be built using our smart features: Smart Actions, Smart Collections, Smart Relationships and Smart Charts.