Connectors / Service / Intercom

Intercom

Intercom

Intercom is a customer messaging tool for sales, marketing, and support, connected in a single unified platform.

Overview

Intercom is a messaging platform which allows businesses to communicate with prospective and existing customers within their app, on their website, through social media, or via email.

v2.0

Authentication

When using the Intercom connector, the first thing you will need to do is go to your Tray.io account page, and select the workflow you wish to work on. Once in the workflow builder itself, search and drag the Intercom connector from the connectors panel (on the left hand side) onto your workflow.

With the new Intercom connector step highlighted, in the properties panel on the right, click on 'New Authentication' which is located under the 'Settings' heading.

This will result in a Tray.io authentication pop-up window. The first page will ask you to name your authentication, and state which type of authentication you wish to create ('Personal' or 'Organisational').

The next page will have a list of permission scopes for you to select (with the option for 'Extra scopes' found at the bottom of the authentication window).

To include certain service permissions, such as 'List all events belonging to user.', tick the box associated with this permission within the Tray.io authentication window. Tick more as per your project needs.

Click on the 'Create authentication' button once your scopes are set, and enter your Intercom credentials into the popup window that appears (this window is to allow Tray.io to access your Intercom account information) Then confirm the scopes again.

Once you have clicked the 'Authorize access' button, go to back to your authentication field (within the workflow dashboard properties panel from earlier), and select the recently added authentication from the dropdown options now available.

Your connector authentication setup should now be complete.

Available Operations

The examples below show one or two of the available connector operations in use.

Please see the Full Operations Reference at the end of this page for details on all available operations for this connector.

Using the Raw HTTP Request ('Universal Operation')

As of version 2.0, you can effectively create your own operations.

This is a very powerful feature which you can put to use when there is an endpoint in Intercom which is not used by any of our operations.

To use this you will first of all need to research the endpoint in the Intercom API documentation v2.0, to find the exact format that Intercom will be expecting the endpoint to be passed in.

Note that you will only need to add the suffix to the endpoint, as the base URL will be automatically set (the base URL is picked up from the value you entered when you created your authentication).

The base URL for Intercom is: https://api.intercom.io

For example, say that the 'List contacts' operation did not exist in our Intercom connector, and you wanted to use this endpoint, you would use the Intercom API docs to find the relevant endpoint - which in this case is a GET request called: List all contacts. More details can be found here.

As you can see there is also the option to include a pagination option within a query parameter, should you wish to do so. So if you know what your method, endpoint and details of your query parameters are, you can get the contacts information with the following settings:

Method: GET

Endpoint: /contacts

Query parameters: Key: per_page, Value: 100

Final Example outcome being: https://api.intercom.io/contacts

Example usage

TRAY POTENTIAL: Tray.io is extremely flexible. By design there is no fixed way of working with it - you can pull whatever data you need from other services and work with it using our core and helper connectors. This demo which follows shows only one possible way of working with Tray.io and the Intercom connector. Once you've finished working through this example please see our Introduction to working with data and jsonpaths page and Data Guide for more details.
Below is an example of a way in which you could potentially use the Intercom connector, to retrieve information about all the companies attached to the listed contacts.

The steps will be as follows:

  1. Setup using a manual trigger and retrieve a list of contacts.
  2. Loop through your collection of retrieved contacts.
  3. List the companies attached to each contact.

The final outcome should look like this:

1 - Setup Trigger & Search Companies

Once you have clicked 'Create new workflow' from your main Tray.io dashboard (and named said new workflow), select the Manual trigger from the trigger options available:

After you have been redirected to the Tray.io workflow dashboard, from the connectors panel on the left, add a Intercom connector to your second step. Set the operation to 'List contacts'.

Note that you can modify number of contacts per page. In this example it is set to 50.

Feel free to re-name your steps as you go along to make things clearer for yourself and other users.

When run, the workflow will retrieve 50 contacts from your Intercom account.

2 - Loop Collection

In order to iterate over this collection of contacts, drag a Loop Collection connector into your workflow as your next step and set the operation to 'Loop list'.

Using the connector-snake, make sure to drag the 'List' field mapping icon from the properties panel over your previous Intercom connector step 'List contacts'. From the dropdown list available, select data.

JSONPATHS: For more information on what jsonpaths are and how to use jsonpaths with Tray.io, please see our Intro page and Data Guide for more details.
CONNECTOR-SNAKE: The simplest and easiest way to generate your jsonpaths is to use our feature called the Connector-snake. Please see the main page for more details.

This should automatically generate a jsonpath that looks similar to: $.steps.Intercom-1.data.

View the Debug panel for more details on the list data available:

Now when the workflow is run, the Loop Collection step will iterate through the each item found within the previously created list.

3 - List Attached Companies

The final step is to drag a final Intercom connector INSIDE of the actual Loop Collection step itself. Set the operation to 'List attached companies'. As you can see, the 'Contact ID' field is required.

In the 'Contact ID' field use the connector-snake once more and assign it to the id value, produced by the Loop Collection connector from the previous step.

When run, this workflow will retrieve detailed information about each of the companies found:

BEST PRACTICES: Whenever you do decide to create your own workflow, please make sure you take a look at our Managing data best practices guide.
## v1.15

Authentication

When using the Tray connector, the first thing you will have to do is to click "New Authentication" in the workflow builder:

Check every scope to allow Tray the correct permissions, then proceed to log in to your intercom account.

Once logged in you'll be shown a similar page to this:

This page highlights to you what data you'll be exchanging with tray.io connector. Select the Authorize access button found at the bottom of the page:

You're now ready to use the Intercom connector!

Example 1: Create / Download export job

This example will show how to use the create export job and the download export job operations found in the Intercom connector.

The first step will be to first to a create an export job using the Create export job operation found in the connector. The two inputs for this operation are Created after and Created before. These two inputs are used to specify the date range of the export.

The Create export job operation tells intercom to start collecting data, it is not instantaneous like a lot of other API calls. Due to the nature of this operation and the fact it could take up to hours to finish an export job, some added steps have to be added to the workflow in order to then download the export.

A loop that runs forever will first be initialised using the Loop collection helper.

This loop will continue running until the export is ready to download from Intercom. To implement this behaviour the next thing to do is use the Download export job operation found in the Intercom connector.

This operation takes one input, the id of the export job which would of been returned in the original Create export job operation that will be ran first. We can use JSONPaths to retrieve this data.

The Download export job has two basic responses:

{ "completedFlag": false, }

The above response is returned when the export job is not ready to be downloaded as Intercom have not finished preparing the export job yet.

{
"completedFlag": true,
"file": {
"url": "https://workflow-file-uploads.s3-us-west-2.amazonaws.com/3ce5077b-62b0-47c2-be22-28a9182c70dc?Expires=1543597994&AWSAccessKeyId=AKIAJFT24F2KYE6CQYBQ&Signature=n3IhsCZnaCMbEitQGe8P0JvCvDE%3D",
"mime_type": "application/octet-stream",
"expires": 1543597995,
},
}

The above response is returned when the export job has been downloaded from Intercom and is ready to use.

The completedFlag variable is a constant and is something that is used to decide whether we can exit our loop or not. Using a boolean condition we will use the completedFlag to decide whether to exit or stay in the loop.

For the condition we can use JSONPaths to get the value of the completedFlag.

Then we can check to see if it's true or false.

If it is true, then it means that the file has been downloaded and can be used. As a result we will have to terminate the loop. This can be down by using the Break loop helper. The Break operation requires you to specify what loop to terminate as you could have more than one in your workflow already.

If it is false, then it means we will have to run through the loop again and wait till the file is ready to download. To prevent lots of calls being made, we can use the Delay helper which can delay the next action within a workflow for a certain amount of seconds.

All Operations

Latest version:

2.1