Basic Examples

 

πŸ›ˆ Potential of Tray: Tray.io is incredibly adaptable. By design, there is no set method to use it; you can use our core and helper connectors to access whatever data you require from other services and manipulate it as needed. The following demo just demonstrates one method of using Tray.io and the HubSpot connector. After completing this example, you can find further information on our page on working with data and jsonpaths as well as our Data Guide

 

 

❕ NOTE: The HubSpot connector's version "3" is the only one that currently supports some of the operations performed in these examples. Therefore, if you want to use this functionality, either go back to version 3.11 or use the Raw Http Request procedure.

 

Here are the two examples on How to help users become familiar with the HubSpot connector.

  1. Create/Update contacts
  2. List and filter contacts using ID

πŸ›ˆ BEST TIP: If you choose to design your own workflow, make sure to review our article on managing data best practices.

Create/Update contacts 

 

Here's a sample of how you might utilize the HubSpot connector to add to or modify a contact's information depending on whether or not the contact currently exists.

 

The actions are as follows:

  • Even if the response is "null," setup a Webhook trigger and capture the contact information related to the incoming data.
  • Examine the contact's status in HubSpot and determine whether or not they are real based on their email address.
  • Create or change the contact in accordance with the outcome.

Your finished workflow would need to resemble this:

hubspot-complete-wf (1)

Setting up trigger and get contact info

 

In this instance, we start by sending sample data received from a third-party source in email format using a Webhook (which indicates an update is required to a contact in Hubspot as per our use case).


Add a HubSpot connector once your trigger is set up (whether it be manual, scheduled, callable, etc.). Select "Find contact by email" as the operation.

 

hubspot-step-1 (1)

To make things clearer for you and other users, feel free to rename your steps as you go. Often, the operation names are sufficient.

This will retrieve all of the contact details for the HubSpot contact who is linked to this email address.

 

Check Contacts exists

 

The next step is to locate the Boolean connector in your connector panel and drag it into your process. Choose "Boolean condition" as your operation type.



With the help of the Boolean connection, you may verify your results using a true/false format. In this illustration, we'll use it to see if the information discovered during the previous HubSpot connector phase is still valid.

 

Start by generating the connector-snake using the list mapping icon, which can be located in the settings panel next to the list input field, in order to identify the contact you wish to examine.

 

Select found from the list of output attributes when positioned over the "Find contact" step (with the connection snake's tail). This will update the type selector to jsonpath and automatically generate a jsonpath within your list input field.

 

Open the Debug panel to see your step's Input and Output to see additional details about the pathways you have available.

πŸ›ˆ JSONPATHS: Please go to our Intro page and Data Guide for further information on jsonpaths and how to utilize them with Tray.io

πŸ›ˆCONNECTOR-SNAKE: Utilizing our tool known as the Connector-snake is the quickest and most straightforward approach to construct your jsonpaths. For further information, kindly go to the home page.

hubspot-step-2 (1)

Don't forget to ensure that "The 2nd of 2 values to compare" has been checked and that the comparison type is set to "Equal to." By switching the "Type selector" to "boolean," the latter is set.

 

Create/ Update contact

Create if NOT found (false)

 

If the response is false, the contact must be established because it is obviously brand-new. From the operation drop-down menu, choose "Create contact."

Note that before executing the 'Create contact' procedure in this example, the date to be provided was also formatted:

hubspot-step-3 (1)

Update if found (true)

 

If the response is True, we must update the current contact with the newly received information. 'Update contact' is the procedure to use.


The important thing to remember is that we utilize the $.steps.hubspot-1.contact.vid jsonpath to access the vid (also known as the contact ID) returned by the "Find contact" step:

 

hubspot-step-4 (1)

List and filter contacts using ID

 

Here is an illustration of how you might use the HubSpot connector to list all of the contacts you have and then search for or filter them using their ID field.

 

The steps are as follows:

  1. Create a manual trigger and list all of the contacts in the relevant HubSpot account.
  2. Go through each contact on the list one more time.
  3. Obtain the pertinent contact details for each person you find.

Your finished workflow ought to resemble this:

 

hubspot-complete-list-wf (1)

Setup the triggers and contact list

 

Add a HubSpot connector once your trigger is set up (whether it be manual, scheduled, callable, etc.). Decide on "List Contacts" as the operation.

hubspot-list-step-1 (1)

To make things clearer for you and other users, feel free to rename your steps as you go. Often, the operation names are sufficient.

The HubSpot connector will now get a comprehensive list of the contacts connected to your account when your trigger is enabled.

 

Loop through contacts

 

The next step is to locate the Loop connector in your connector panel and drag it into your workflow. Specify "Loop list" as your operation.

 

A list of results can be iterated through using the Loop connection. In this illustration, we'll use it to repeatedly iterate over the information obtained in the prior HubSpot connector phase.

 

Start by utilizing the list mapping icon (located next to the list input field, within the properties panel) to build the connector-snake in order to define the list you want to loop through.


Select contacts from the list of output attributes shown while moving the connector snake's tail over the "List" field in the "List contacts" stage. This will update the type selector to jsonpath and automatically generate a jsonpath within your list input field.

 

Open the Debug panel to see your step's Input and Output to see additional details about the pathways you have available.

hubspot-list-step-2 (1)

The list of contacts found in the previous phase will now be iterated over one at a time when your workflow is executed.

 

Get contact information

 

Drag a Hubspot connector into the Loop connector step itself as the final step. The operation should be set to "Find contact by ID." The 'Contact ID' field is necessary, as you can see.


The same procedure you used in the previous step can be used to construct this jsonpath; however, this time, attach the connector-tail snake's to the Loop connector. When the menu appears, select vid.

 

hubspot-list-step-3 (1)

Now, when the program is launched, specific information will be collected for every contact in the contacts list.

 

For further information, look at your Output in the Debug panel:

hubspot-list-step-4 (1)