I’m working on a Salesforce integration using the HubSpot Engagements API to migrate emails. I’m able to retrieve email engagements using the /engagements/v1/engagements/paged endpoint. However, I now want to:
Retrieve only emails created between 6 to 10 months ago.
Since the API doesn’t seem to support date filtering via query parameters, I’m wondering:
Is there a way to filter by timestamp (e.g., createdAfter, createdBefore) at the API level?
Or do I have to paginate through all results and filter by timestamp manually in Apex?
Any official guidance or best practices would be appreciated.
I would like to invite some members of our community who may offer valuable insights.— hey @HMir, @SteveHTM, @nickdeckerdevs1 - Could you share your advice with @sridharan?
Hey! I need a bit more context to what you are doing with these engagements -- once you have these emails/engagements, are you looking to assign them to send them to Salesforce and attach them to specific records?
What is the current way you are planning on doing this? How are you matching them up with the salesforce records you need to match them to?
Are you triggering these from SF to reach out and get engagements for a specific record? What is the whole concept you are going for?
Totally get wanting to skip that full crawl, filtering by date would save a ton of overhead. Just to confirm: are you tied to the /engagements/v1/engagements/paged endpoint, or open to switching to the newer CRM API?
That legacy endpoint doesn’t support createdAfter or createdBefore, so yep, you’d need to page through and filter in Apex.
I had to do this once and added a timestamp cutoff to bail early once I hit records older than 10 months. Not pretty, but it worked.