Standard/Best Practices
Use Cases
Connecting to on-prem systems

Lead enrichment (med.)

This tutorial will introduce you to how Tray can be used to automate lead enrichment - the process of increasing both the quantity and the quality of information you have for a particular lead, in order to increase the success of sales processes.

In this tutorial you will be introduced to:

  • Clearbit

  • Salesforce

  • The Scheduled Trigger (in example 2)

  • The Math Helpers connector (in example 2)

  • The Boolean Connector (in example 2)

Note that the below examples demonstrate how to use some Clearbit Operations and the data they return. They use a single lead / email address to demonstrate this. In a production environment you would likely be working with lists of emails etc. pulled from other services, and would be using our tools such as the List Helper, Loop Connector an the methods explained in our section on Pagination

Set the Trigger

For this workflow we will set the trigger as 'Manual', as this is ideal for testing. Once the workflow is set up all you need to do is click 'Run Workflow' to initiate a test run and check the results - in both Salesforce and the input/output logs of your Tray workflow.


When using the Clearbit connector, the first thing you will have to do is click on 'New Authentication' in the step editor:

You will then need to add your Clearbit API key, obtained from the Clearbit Admin UI:

Example 1 - obtaining data for lead scoring

You can use Clearbit to find out key lead scoring information on an individual and their company - using metrics such as executive position, social following and annual company revenue.

A way to do this would be to use the Enrichment - person & company by email operation, whereby all you need to do is enter a company email address.

To try this, create a new workflow with a manual trigger and a Clearbit connector:

Authenticate your Clearbit connector as above and use the Enrichment - person & company by email operation, entering the email address in question:

After clicking 'Run Workflow' you can use the 'Debug' tab to inspect the results.

From the 'employment' section you can see that he is the CEO:

And from the Twitter section you can see how many followers he has:

We can then look at the company details and get some data on revenue and number of employees:

And also on geographical location:

Creating the Lead in Salesforce

You can then add a Salesforce step to your workflow (please see our Salesforce documentation for instructions on authenticating with Salesforce):

Then set it to create a new Lead:

After clicking 'Add Fields' it is then possible to grab any data from the Clearbit step using $.steps.clearbit-1.person. and $ jsonpaths:

The jsonpaths for any piece of data can be automatically picked up by using the Tray 'Connector Snake':

Make sure you grab all the necessary pieces of data before running/enabling your workflow.

When ready, click on 'Run Workflow' and you can then check your Salesforce account to see the new Lead added. You can also inspect the 'Debug' tab in the Tray workflow editor to see the input and output at each step.

Example 2 - Update the Rating of a Lead based on follower count increase

This example shows how you can use Tray to make periodic checks to see if a Lead's Twitter following has increased significantly over a certain period of time - in which case you can update their Lead Rating in Salesforce.

The complete workflow looks like this:

The following steps:

  1. Create a workflow with a scheduled trigger to check perhaps every week or two weeks

  2. Add the Find Lead in Salesforce connector to find the Lead by email. This is done by specifying that Lead ID and Followers are the fields returned:

and by using the 'Conditions' parameter to find by email:

Note: This example manually inserts the email, but in a production environment you would be working with batches of leads - in which case you would list your Leads from Salesforce and work through them one-by-one. An explanation of how you can work with data in this way can be found in our section on Pagination

  1. Add the Clearbit Get new follower count connector:

  1. Add the Get follower increase math helper and subtract the old follower count from the new follower count:

  1. Add the More than 1000 new? boolean condition to check if the result from the math helper is over 1000:

  1. On the True branch add the Update Rating and Followers in Salesforce connector and grab the Lead Id as the record to update:

then update the Rating and Followers count:

  1. On the False branch you can duplicate the True branch connector, but remove the update to the Rating, so that only Followers are updated for the next time the check is made.