Agreed this is a big problem. We have a need to blocklist domains - it’s not an option not to. For two reasons: 1. To prevent vendors and other non-sales/customer contacts from going to the CRM. 2) To restrict certain IPs and known corporate domains from receiving email or ads or starting a new trial of our software (authentication at the time of landing page form submission).
Here is the workaround we are using with Zapier for the 1st example of catching/removing contacts created that match a domain from the blocklist. The second example is a bit more involved, happy to share via PM though.
Apps involved:
Hubspot CRM
Google sheet with list of blocklist domains
Formatter by Zapier
Webhooks by Zapier (Hubspot Email API- PUT)
Webhooks by Zapier (Hubspot Contacts API- PUT)
Zap Flow:
Step 1: Trigger: New contact created in Hubspot CRM
Step 2: Action: Formatter by Zapier - Transform: Split Text. Input: email. Separator: @. Segment Index: Second
(this creates the domain value for lookup purposes)
Step 3: Action: Google Sheets look up spreadsheet row: Spreadsheet: blocklist. Worksheet: domain. Lookup column: domain. Lookup value: Formatter - domain
Flow only continues if successful match.
Step 4: Action: WebHooks by Zapier: PUT
This unsubscribes the contact ID of the contact (select from the Trigger step) from all email in Hubspot.
JSON code here: Hubspot Email API: update_status
Example PUT URL:
https://api.hubapi.com/email/public/v1/subscriptions/example@domain.com
Example PUT data for unsubscribing an email address from all email:
{
"unsubscribeFromAll": true
}
Example PUT data for unsubscribing from specific email types:
{
"subscriptionStatuses": [
{
"id": 7, "subscribed": false
}
]
}
On success, returns a 200 response with this JSON:
{
"status": "ok"
}
Step 5: Action: Webhooks by Zapier: PUT
This deletes the contact ID of the contact (select from the Trigger step) from Hubspot.
JSON code here: Hubspot Contacts API: delete_contact
Example DELETE URL:
https://api.hubapi.com/contacts/v1/contact/vid/61571?hapikey=demo
Example JSON output:
{
"vid": 61571,
"deleted": true,
"reason": "OK"
}