Open Navigation

Intercom

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

Overview

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



Authentication

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

tray-auth-button

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

docs-tick-permission

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

intercom-permissions

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:

docs-auth-access

You're now ready to use the Intercom connector!

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.

create-export-job

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.

create-loop

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.

download-export-job

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.

snake-joiner)

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.

boolean-condition

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

add-boolean-snake

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

boolean-condition-variables

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.

break-loop

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.

delay

Was this article helpful?
Yes
No