Webhook for contact opting out of email?

jelledv
Member

Currently I'm testing the HubSpot API for an integration I'm going to build. For this I would like to subscribe to a webhook, which notifies me when an user opted out of receiving emails.

 

While the API returns 'hs_email_optout', which indicates the user is opted out, it cannot be selected when creating a webhook for an app when selecting Contact -> Property changed.

 

How could I go about this? I'm trying to achieve a similar thing as with MailChimp, with where I'm able to create a webhook, which notifies me whenever a contact unsubscribes from a list.

0 Upvotes
2 Replies 2
Willson
HubSpot Employee

Hi @jelledv 

 

When a contact opts out of an email subscription type or opts out from all emails, the subscribed value will be false; we can use the webhook subscription to listen to updated contact property events. 

 

Note: While the standard properties only include hs_email_optout which means if a contact opt out of all email, this property will change and if you're looking to receive subscription status for an individual email type and if your team is either professional/enterprise subscription, we can use a workflow to set up something like this:

  • Set the enrollment trigger to "Contact has opted out of all of e.g. email subscription type A"
  • Set a custom contact property to TRUE

Having the custom property update in the workflow, we can use it to create the webhook subscription and listen to update on those custom properties.

 

I hope this helps!

Product Expert | Customer Support
HubSpot
0 Upvotes
heaven
Member

Hi Matthew,

 

I have a follow-up question regarding these webhooks. In our app, we rely on timestamps an event occurred but objects I receive from a webhook don't include this information and as a result, I don't know when the event was fired.

 

Does Hubspot guarantee that webhooks events will be delivered in the order they were created? Otherwise, when someone unsubscribed and then subscribes back events could be processed in the reverse order. Which would lead to different subscription statuses in Hubspot and in our CRM.

 

Best,

Alexander

0 Upvotes