Ziggy - Services and Product Help

SQL To Hubspot with Javascript

DB to Hubspot with Javascript

This Flow delivers exactly the same functionality as the previous example - just done using Javascript rather than the Hubspot Utility Block.

Having first got the customer data from the database

  • The Javascript Block sets up the Hubspot data object in the expected format.

  • It then calls a Subflow, which looks as follows.

Subflow

Receiver

You can see that this Block has some hard coded data in there. This is only used for testing the subflow is isolation from the editor. When called by another Flow, it will use the data passed into the Flow by the caller.

Splitter

This simply takes the two keys in the edge data record and splits it into two individual edges.

In practice, this is not really needed in the Flow as you could just as easily omit it, use one input argument in the Javascript and split it out there.

Javascript

This makes the actual Hubspot API call. You will notice that we can access a Connection configuration directly.

connections.hsClient.crm.objects.batchApi.upsert()

We then put data onto an output edge using

return {o0: results}

Each key in the return object represents an individual output edge. We are only outputting one edge here. But using more allows for other parallel operations to take place.

Last modified: 10 February 2025