How to Integrate Intercom with Bugfender

How to Integrate Intercom with Bugfender

Engineering
Fix bugs faster! Log Collection Made Easy
START NOW!

In this post we’re going to talk about how to integrate Intercom into your mobile apps. The company offers both iOS and Android SDKs and you’ve probably used them before in your different products (we certainly use them in Bugfender).

Why Integrate Bugfender and Intercom?

How many times has someone contacted you via your app and you’ve had to request more information from them, such as: which devices they own, which OS Version they’re using, which language their device uses and which timezone they’re based in, which things have they tried already, is there an error message appearing on their screen?

Intercom provides some of the basic information automatically when integrating their SDK, but not the application logs registering the actions performed by the user and internal state of the application, as Bugfender does.

What’s even better is that, with Bugfender you can see all the user sessions in Intercom, giving you a full panorama of what the user has done with your app. With all this information you’ll be able to provide much better customer support.

How Do I Perform the Integration?

The key to integrating Intercom is to provide a way to identify the device within Bugfender. To make this process easier, in the latest SDK versions, we have added two new methods that will help you.

In iOS
+ (NSURL *)sessionIdentifierUrl;
+ (NSURL *)deviceIdentifierUrl;

In Android:
static URL getSessionUrl()
static URL getDeviceUrl()

With these two new methods, you can easily link an Intercom user with a Bugfender device.

In this article we don’t intend to show you how to integrate Intercom in your app. You’re better-off checking this via the Intercom documentation (https://developers.intercom.com/installing-intercom/docs/ios-installation and https://developers.intercom.com/installing-intercom/docs/intercom-for-android).

Device Identification

To facilitate the integration process, it’s really important to provide easy access to the Bugfender device. To do this we’re going to add a new custom attribute in Intercom that includes a link to the user device within Bugfender.

Here you have an example of how you can initialize Bugfender and Intercom to get the information on each user. By way of an example, here’s the Android-Java code:

private void initBugfender()    {
    Bugfender.init(this, "<yourappkey>", BuildConfig.DEBUG);
    Bugfender.enableUIEventLogging(this);
    Bugfender.enableCrashReporting();
}

public void initIntercom()
{
    Intercom.initialize(this, "<intercom_app>", "<intercom_app_id>");
}

Once you have both libraries ready, at some stage of your code you’ll be sending the user to Intercom to have it identified there. You might have some code similar to:

Registration registration = Registration.create().withUserId("<user_id>");
Intercom.client().registerIdentifiedUser(registration);

Then, when the user logs in, you are already probably sending some user attributes with a code similar to this:

UserAttributes userAttributes = new UserAttributes.Builder()
    .withName("Bugfender Test User")
    .withEmail("[email protected]")
    .build();
    Intercom.client().updateUser(userAttributes);

It’s at this point that we want to add a custom attribute with the device link to Bugfender. To do this you can change your code to:

UserAttributes userAttributes = new UserAttributes.Builder()
    .withName("Bugfender Test User")
    .withEmail("[email protected]")
    .withCustomAttribute("bugfender_device", Bugfender.getDeviceUrl().toString())
    .build();
    Intercom.client().updateUser(userAttributes);

NOTE: It’s important to use .toString() to convert the URL to a String, otherwise Intercom will not be able to use the attribute.

Once you have done this, your users will have a Bugfender device attribute in their properties.

User Sessions

You might know that Intercom also carries the option to log events. By default the mobile SDK doesn’t log anything, but we recommend that you log the sessions and link them with the Bugfender session.

You can easily achieve this by adding the following code to your application entry point (usually AppDelegate for iOS or onCreate in Android):

//Log user session
Map<String, Object> eventData = new HashMap<>();
eventData.put("url", Bugfender.getSessionUrl());
Intercom.client().logEvent("bugfender_session", eventData);

Once you have done this, you will be able to see the session in the Intercom page and go directly to the Bugfender session by clicking on the link.

Having both tools integrated and linked will allow you to provide quicker and better support to your customers. We’re sure your support team and developers will be happy to have everything integrated, saving the time trying to figure out bugs and problems within your app, which is one of Bugfender’s key goals. Happy coding!

Expect the Unexpected! Debug Faster with Bugfender
START FOR FREE

Trusted By

/assets/images/svg/customers/highprofile/kohler.svg/assets/images/svg/customers/highprofile/disney.svg/assets/images/svg/customers/highprofile/schneider_electric.svg/assets/images/svg/customers/cool/napster.svg/assets/images/svg/customers/projects/vorwerk.svg/assets/images/svg/customers/cool/starbucks.svg/assets/images/svg/customers/projects/taxify.svg/assets/images/svg/customers/highprofile/dolby.svg

Already Trusted by Thousands

Bugfender is the best remote logger for mobile and web apps.

Get Started for Free, No Credit Card Required