Forum Academy Marketplace Showcase Pricing Features

Help with Linking two Data Types in two Separate API Calls

Hi Guys,

I have a business where we have affiliates who refer contacts to us. In our CRM (Hubspot) we then create (sometimes multiple) deals which are associated to each contact.

I am trying to create a portal for our affiliates to view a list of all their referred contacts with some associated details like, Contact Details and Deals.

So to explain the structure:

  • An affiliate is a User who will login to the portal
  • An affiliate refers us a contact
  • A contact may have multiple deals attached to it

I want to display the referred contacts, with their associated deals in a table.

The information flow happens like this:

  1. A contact gets created in Hubspot (our CRM). The contact has a property Referrer. The Referrer property tells us which Affiliate the contact came from.
  2. A contact has one (or a few) Deals created for it.
  3. When a Deal status changes (from Open to Accepted, for example), I want to update the status of that Deal in the appropriate Affiliate’s portal.
  4. I have a trigger setup in Hubspot on Deal Status Change to post a webhook with the Deal’s information to Integromat. Integromat then creates a new Contact

My question is regarding how to link the three Data Types: Affiliates, Contacts, Deals. I want to be able to look up an affiliate, find a contact (if it doesn’t exist, create it) they have referred, find the associated deal (which has had a status update in Hubspot), and update the deal_status Field within Hubspot. I am just not sure how to link the three.

This example should illustrate my problem. Please see the Integromat screenshot:

  1. I am catching the webhook response for when a new deal is created in Hubspot.
  2. I am creating a new Deal in Bubble.
  3. I set the fields using the Hubspot properties.
  4. Now I don’t know how to set the field referral of type Contact so that it links this deal to a previously created Contact.

Should I be trying to do it in Integromat, or using Workflows in Bubble?

Attached images are for reference on the three different data types and how I have linked them.

Update: I’m thinking of using backend workflows to achieve the link.

So when a new contact is added, I have a workflow which assigns the current contact to the User. Same for when a new Deal is added. Assign to the Contact, based on certain contact fields.

If you’re reading this… does this sound like the right solution?