Issue with Batch Updates to HubSpot API

Hi Retool Community,

I’m currently setting up a workflow in Retool to send batch updates to HubSpot using their API. I’m trying to process data in batches due to HubSpot's limit of 100 records per request. I’ve already created queries to fetch and prepare the data, and now I’m using Retool’s Loop Block to manage sending batches to the API.

Here’s an overview of my workflow:

  1. formattedArray Query: This processes data to match HubSpot’s expected format.
  • The structure it returns looks like this:
[
{
  "id": 6729213154,
  "properties": {
    "_status": "unqualified",
    "last_contact_date": null,
    "reason_for_closing_topic": null,
    "_notes": null,
    "cause": null
  }
},
{
  "id": 6960852446,
  "properties": {
    "_status": "unqualified",
    "last_contact_date": null,
    "reason_for_closing_topic": null,
    "_notes": null,
    "cause": null
  }
}
...
]

This query is working as expected and returns an array of objects, each containing an id and properties as required by the HubSpot API.

  1. Loop Block: I want to send the data in batches of 3 records at a time.
    I’m using the Batch Execution Mode with a batch size of 3.
    In the Loop Lambda section, I’m returning value to pass the current batch to the next query (see attached screenshots).

As you can see in screenshot it still returns all 10 records and sends those to sendDataToHubspot query.
How to make this work in actual batches?

1 Like

Hey there @mondob

I think that you your loop block should be the actual Hubspot resource, and just refer as {{ value }} so that it takes each as many arrays as specified in your batches settings

1 Like

Thanks for getting back to me @MiguelOrtiz. That really makes sense!

1 Like