APIs & Integrations

renlab
Member

How to check for "Marketing email confirmation status" via HubSpot API?

Hello,


We want to build a content locker feature on our WordPress website to capture new leads. We have a page where premium content is "gated/hidden" (soft-locked) by a Newsletter email capture form popup. We want the person to enter and confirm their email via the HubSpot double opt-in feature, as we want to prevent anyone from entering dummy emails and accessing the content without providing us a meaningful lead.


The flow we're looking for is broadly outlined below:

1. Person enters their email on the email capture form in our locked-content page.
2. Our website sends this email to HubSpot.
3. HubSpot then sends the person the double opt-in confirmation email.
4. Person clicks the confirmation link to confirm their email (basically confirming that they are an existing person and not a robot or someone who entered something like test@test.com to access our premium content).
5. HubSpot updates the person's "Marketing email confirmation status".
6. Person goes back to our gated page and enters their email (our website sends an API call to check for the "Marketing email confirmation status"
7. Response is sent back from HubSpot and content is unlocked (pending their confirmation status is "User clicked confirmation")

Now, I was looking at the docs, but since I'm a novice developer I couldn't find anything related to checking for the "Marketing email confirmation status" via API.

I found some posts regarding setting the "Marketing email confirmation status" via API, but this is not what I'm looking for. I do not want to set said status (I understand this is not possible at the moment), but rather just check the "Marketing email confirmation status value" and send that value to back our website in order to deny or unlock our content. I would appreciate any insights if someone's ever done something like this.

 

EDIT: Now that I think about it, we could just check if the contact exists in HubSpot. Do you think this is the way I should go? https://developers.hubspot.com/docs/api/marketing-api/subscriptions-preferences#endpoint?spec=GET-/c...


Kind regards

0 Upvotes
1 Reply 1
dennisedson
HubSpot Product Team
HubSpot Product Team

How to check for "Marketing email confirmation status" via HubSpot API?

@renlab 

You can check it with the subscription preferences api if you have the email.

You would do a get request that looks something like this:

https://api.hubapi.com/communication-preferences/v3/status/email/calvin@calvinandhobbes.com

 

That will send back a json object with an array containing all subscriptions.

Sidenote, you can use this API to subscribe/unsubscribe people.  The exception is if they have opted out of all emails. 

0 Upvotes