APIs & Integrations

angel-luis
Member

How to Trigger a Mass Email to Filtered Contacts from a Webhook with a Custom Object in HubSpot Work

SOLVE

Good morning,

Let me give you some context and try to explain in as much detail as possible the use case we need to cover. Please, we would appreciate a response with the most concrete solution possible, as we’ve been trying different alternatives for several days without success 😟

The idea is to receive a webhook containing a custom object called "New Offer" with data similar to:

{offer: {name: "New offer", price: 99}}

 

This object does not share any properties with any contact, as it’s a completely separate general entity unrelated to contacts.

When we receive this webhook, we would like to send a mass email to contacts who have specific values in their properties:

  • Subscription → Basic

  • IWantByNotified → Yes

To achieve this, we’ve considered either filtering those contacts at the time of sending the email or creating a dynamic active list that only includes those users.

The problem arises when we consider that there could be many users (in the thousands), and we’re limited by API call constraints.

Our first idea was to create two workflows:

  1. One that receives the webhook and updates the contact properties. However, since the trigger is based on a custom object, we would need to update the contacts via a custom code action, which has its limitations (execution time cannot exceed 20 seconds, API calls are limited, pagination needs to be handled, etc.). This approach likely won’t scale well if we have many users in the future and could eventually fail.

  2. Another one triggered by a modification to a contact’s property, which then sends the email.

We believe this is a relatively common use case, but we haven't been able to find a working solution. That’s why we would need a concrete approach to help us implement it.

Ideally, workflows would allow us to directly use the webhook data to send emails to the contacts in a list, but we believe this isn’t possible. Maybe there’s another way to do it (with campaigns or something similar), but we haven’t found anything viable within workflows.

Thank you very much for your time.
Kind regards.

0 Upvotes
1 Accepted solution
kosalaindrasiri
Solution
Top Contributor | Partner
Top Contributor | Partner

How to Trigger a Mass Email to Filtered Contacts from a Webhook with a Custom Object in HubSpot Work

SOLVE

Hey @angel-luis,

I shared your issue with our dev team.

They suggest trying a Smart List combined with a Static List as a possible workaround. They haven’t tested this exact method before, but they believe it could be the most effective solution for your situation.

 

  1. Create an active list with your filter (subscription + notify).
  2. Use a scheduled workflow that enrolls contacts in that list.
  3. Then use that workflow to send the email directly (no update needed).

You can use a delay to schedule it shortly after the "New Offer" event.

Pros: No custom code, no rate limit issues.
Limitation: Can't dynamically pass offer data into email unless it's a global offer (not personalized).

 

Also refer:

 

Hope this will help!

 

Best Regards,

Kosala Indrasiri

CEO

Sanmark Solutions
Linkedin
Kosala Indrasiri
emailAddress
kosala@thesanmark.com
website
www.sanmarksolutions.com
linkedinwhatsapp
Book a Consultation

Did my post help answer your question? Mark this as a solution.

View solution in original post

0 Upvotes
5 Replies 5
kosalaindrasiri
Top Contributor | Partner
Top Contributor | Partner

How to Trigger a Mass Email to Filtered Contacts from a Webhook with a Custom Object in HubSpot Work

SOLVE

Hey @angel-luis,

 

To send a mass email when a “New Offer” webhook is received (via a custom object), the best approach is,

  • Trigger a workflow on the custom object creation.
  • Use a custom code action to update a custom property on all matching contacts.
  • Create a contact-based workflow that triggers on that property change and sends the marketing email.

More Read:

 

Hope this will be a help!

 

Regards,

Kosala Indrasiri

CEO

Sanmark Solutions
Linkedin
Kosala Indrasiri
emailAddress
kosala@thesanmark.com
website
www.sanmarksolutions.com
linkedinwhatsapp
Book a Consultation

Did my post help answer your question? Mark this as a solution.

0 Upvotes
angel-luis
Member

How to Trigger a Mass Email to Filtered Contacts from a Webhook with a Custom Object in HubSpot Work

SOLVE
Thank you for your response. My question is:
If there are thousands of matching contacts, in the custom code action I would have to call the corresponding API endpoint to filter the contacts, paginate through them, and update them — potentially hitting HubSpot's API rate limits, right?
Is there no way to update all the contacts at once?

kosalaindrasiri
Top Contributor | Partner
Top Contributor | Partner

How to Trigger a Mass Email to Filtered Contacts from a Webhook with a Custom Object in HubSpot Work

SOLVE

Oh, I see what you mean! 😑

 

You can move the logic to your server or cloud function instead of a HubSpot custom code action. But you still need to obey rate limits, but you have more control.

https://developers.hubspot.com/docs/guides/apps/api-usage/usage-details

 

Unfortunately, I don’t have a better workaround for this right now. 😕

But @angel-luis, I’ll share this issue with my dev team. They might have some ideas to work around it.

 

Regards,

Kosala Indrasiri

CEO

Sanmark Solutions
Linkedin
Kosala Indrasiri
emailAddress
kosala@thesanmark.com
website
www.sanmarksolutions.com
linkedinwhatsapp
Book a Consultation

Did my post help answer your question? Mark this as a solution.

0 Upvotes
kosalaindrasiri
Solution
Top Contributor | Partner
Top Contributor | Partner

How to Trigger a Mass Email to Filtered Contacts from a Webhook with a Custom Object in HubSpot Work

SOLVE

Hey @angel-luis,

I shared your issue with our dev team.

They suggest trying a Smart List combined with a Static List as a possible workaround. They haven’t tested this exact method before, but they believe it could be the most effective solution for your situation.

 

  1. Create an active list with your filter (subscription + notify).
  2. Use a scheduled workflow that enrolls contacts in that list.
  3. Then use that workflow to send the email directly (no update needed).

You can use a delay to schedule it shortly after the "New Offer" event.

Pros: No custom code, no rate limit issues.
Limitation: Can't dynamically pass offer data into email unless it's a global offer (not personalized).

 

Also refer:

 

Hope this will help!

 

Best Regards,

Kosala Indrasiri

CEO

Sanmark Solutions
Linkedin
Kosala Indrasiri
emailAddress
kosala@thesanmark.com
website
www.sanmarksolutions.com
linkedinwhatsapp
Book a Consultation

Did my post help answer your question? Mark this as a solution.

0 Upvotes
angel-luis
Member

How to Trigger a Mass Email to Filtered Contacts from a Webhook with a Custom Object in HubSpot Work

SOLVE

Hello @kosalaindrasiri, firt of all, thanks for your suggest.

 

Regarding step 2. I don't understand why I scheduled workflow that enrolls contacts in an active list. This list will be updated automatically.

 

And regarding the limitation it is necessary to personalize the mail with the information that comes in the custom object of the webhook.

 

Regards!

0 Upvotes