Configuration

Track who your users are and what they do in your mobile app and customize the Intercom Messenger. Here’s how to configure the Intercom React Native wrapper:

Update a user

You can send any data you like to Intercom from standard user attributes that are common to all Intercom users to custom user attributes that are unique to your app.

Standard user attributes can be updated by calling:

Intercom.updateUser({
  email: 'bob@example.com',
  userId: 'bob-123',
  name: 'Bob',
  phone: '010-1234-5678',
  languageOverride: 'fr',
  signedUpAt: 1621844451,
  unsubscribedFromEmails: true,
});

Typically our customers see a lot of value in sending custom data that relates to customer development, such as price plan, value of purchases, etc. Custom user attributes can be created and modified by passing in customAttributes object to updateUser:

Intercom.updateUser({
  customAttributes: {
    monthly_spend: 123,
    paid_subscriber: true,
    team_mates: 3
  }
});

You can also set company data on your user with the Company object, like:

Intercom.updateUser({
  companies: [{
    createdAt: 1621844451,
    id: 'companyId', // id is a required field for adding or modifying a company.
    monthlySpend: 100,
    name: 'CompanyName',
    plan: "plan",
    customAttributes: {
      city: "New York"
    },
  }],
});

Submit an event

You can log events in Intercom that record what users do in your app and when they do it. For example, you could record the item a user ordered from your mobile app, and when they ordered it.

Intercom.logEvent('order-item', {itemId:'item-1', orderDate:"1392036272"})

Customize the Intercom Messenger

We definitely recommend that you customize the Intercom Messenger so that it feels completely at home on your mobile app. Here’s how:

Choose how the launcher appears and opens for your users

If you’d like the standard launcher to appear on the bottom right-hand side of your screen, just call:

Intercom.setLauncherVisibility(Visibility.VISIBLE)

If you want to set the bottom padding for the Messenger, which dictates how far from the bottom of the screen the default launcher and in-app messages will appear, you can call:

Intercom.setBottomPadding(120)

Create a custom launcher

However, if you’d like the Messenger to open from another location in your mobile app, you can create a custom launcher. This allows you to specify a button, link or element that opens the Messenger. For example, you can trigger the launcher to open when a customer clicks on your ‘Help and Support’ button.

If you have a custom launcher, you can call Intercom.present();

<Button title="Open Intercom Messenger" onPress={()=>{Intercom.present();}}/>

Then we’ll ensure the Messenger opens in the best place for each user.

For example:

  • If a user has one unread conversation, we open that conversation.
  • If a user has no conversations, we open the composer.
  • If a user has more than one unread conversation, we open the conversations list.
  • If a user has no unread conversations, we open the last screen they were on when they closed it.

Show your user’s unread message count

Grab the current count with this method:

Intercom.getUnreadConversationCount()

Then, start listening for updates using:

useEffect(() => {
    const countListener = Intercom.addEventListener(
      IntercomEvents.IntercomUnreadCountDidChange,
      (response) => {
        setCount(response.count as number);
      }
    );

    return () => {
      countListener.remove();
    };
  }, []);

Temporarily hide notifications

You can prevent in app messages from popping up in certain parts of your app, by calling:

Intercom.setInAppMessageVisibility(Visibility.GONE)

📘 Mobile Carousels Visibility

The method setInAppMessageVisibility does not apply to Mobile Carousels. They will always be displayed.

You can hide any Intercom screen in your app, by calling:

Intercom.hideIntercom();

To present a Carousel, pass in a carouselId from your Intercom workspace to the following method:

let carouselContent = IntercomContent.carouselWithCarouselId(carouselId)
Intercom.presentContent(carouselContent)

🚧 Make sure your carousel is live

A carousel must be ‘live’ to be used in this feature. If it is in a draft or paused state, end-users will see an error if the app tries to open the content.

Present a Survey Programmatically

To present a Survey, pass in a surveyId from your Intercom workspace to the following method:

let surveyContent = IntercomContent.surveyWithSurveyId(surveyId)
Intercom.presentContent(surveyContent)

🚧 Make sure your survey is live

A survey must be ‘live’ to be used in this feature. If it is in a draft or paused state, end-users will see an error if the app tries to open the content.

What's next?

Now that you have Intercom configured it's time to: