PipedreamHQ:master ← MCKLtech:patch-3
opened 03:50PM - 13 Oct 23 UTC
Slack Discussion: https://pipedream-users.slack.com/archives/CMZG4EBJ9/p16972109…29916869
https://api.hubapi.com/crm/v3/objects/contacts/batch/read can only accept 50 inputs per call. If there are more than 50 contacts, it will fail with the following message:
"The maximum number of inputs supported in a batch request for property histories is 50. Please reduce the number of items and try again"
The code loops over the Contact IDs and limits the inputs to less than 50.
## WHAT
<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at 3741e30</samp>
Improved the performance and reliability of the `new-contact-property-change` source by processing the updated contacts in batches. Added a `batchSize` variable and a for loop to `new-contact-property-change.mjs` to implement the batching logic.
<!--
copilot:poem
-->
### <samp>🤖 Generated by Copilot at 3741e30</samp>
> _`batchSize` splits contacts_
> _HubSpot API is spared_
> _`after` marks time_
## WHY
Fixes bug whereby the workflow will fail if there are more than 50 Contacts in the BATCH API call
## HOW
<!--
copilot:walkthrough
-->
### <samp>🤖 Generated by Copilot at 3741e30</samp>
* Reduce the number of API calls to HubSpot by processing updated contacts in batches of 45 ([link](https://github.com/PipedreamHQ/pipedream/pull/8462/files?diff=unified&w=0#diff-a744670a02ee30bc9376f1b9c828607195e5a580fbbc0b76f4a2519caef21550L110-R133))