Subscriptions: How to tell if an e-mail is subscribed or not?

gustafm
Member

When accessing the HubSpot API to get the current subscription status for a given e-mail address, using the URL

/communication-preferences/v3/status/email/{emailAddress}

I always get the same, whether an e-mail is subscribed or not. The difference can only be seen in the backend on the contact page below subscriptions. How can I get the correct result if an e-mail was not yet used for a subscription?

 

    [subscriptionStatuses] => Array
        (
            [0] => Array
                (
                    [id] => {redacted}
                    [name] => One to One
                    [description] => One to One emails
                    [status] => SUBSCRIBED
                    [sourceOfStatus] => SUBSCRIPTION_STATUS
                    [brandId] => 
                    [preferenceGroupName] => 
                    [legalBasis] => 
                    [legalBasisExplanation] => 
                )

 

0 Upvotes
5 Replies 5
dennisedson
Community Manager

@gustafm 

I just tested on my end (using postman) and this is the response which shows the subscription status:

{
    "recipient": "willy@wonka.com",
    "subscriptionStatuses": [
        {
            "id": "9830020",
            "name": "One to One",
            "description": "One to One emails",
            "status": "NOT_SUBSCRIBED",
            "sourceOfStatus": "SUBSCRIPTION_STATUS",
            "brandId": null,
            "preferenceGroupName": null,
            "legalBasis": null,
            "legalBasisExplanation": null
        },
        {
            "id": "9700012",
            "name": "Customer Service Communication",
            "description": "Receive feedback requests and customer service information.",
            "status": "NOT_SUBSCRIBED",
            "sourceOfStatus": "SUBSCRIPTION_STATUS",
            "brandId": null,
            "preferenceGroupName": null,
            "legalBasis": null,
            "legalBasisExplanation": null
        }
    ]
}
Thanks,

Dennis




Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content
0 Upvotes
gustafm
Member

Hi Dennis,

 

that looks good with your account. Here, however, status is never NOT_SUBSCRIBED, no matter what e-mail address I use. This is an example with curl via the command line. I am pretty sure that krkrkrkrkrkrkrkr and so on with example.com as a domain is not an e-mail address in use. But even a test with e-mail invalid@invalid.test returns that this e-mail has status SUBSCRIBED. The API key is correct, it is possible to subscribe an address. It is simply that I cannot see whether someone is already subscribed or not.

 

% curl --request GET \
  --url 'https://api.hubapi.com/communication-preferences/v3/status/email/krkrkrkrkrkkrkr@example.com?hapikey=REDACTED_KEY'
{"recipient":"krkrkrkrkrkkrkr@example.com","subscriptionStatuses":[{"id":"REDACTED_ID","name":"One to One","description":"One to One emails","status":"SUBSCRIBED","sourceOfStatus":"SUBSCRIPTION_STATUS","brandId":null,"preferenceGroupName":null,"legalBasis":null,"legalBasisExplanation":null},{"id":"REDACTED_ID","name":"Newsletter EN ","description":"Newsletter EN ","status":"SUBSCRIBED","sourceOfStatus":"SUBSCRIPTION_STATUS","brandId":null,"preferenceGroupName":null,"legalBasis":null,"legalBasisExplanation":null},{"id":"REDACTED_ID","name":"Marketing Information","description":"Marketing offers and updates.","status":"SUBSCRIBED","sourceOfStatus":"SUBSCRIPTION_STATUS","brandId":null,"preferenceGroupName":null,"legalBasis":null,"legalBasisExplanation":null},{"id":"REDACTED_ID","name":"Newsletter DE","description":"Newsletter DE","status":"SUBSCRIBED","sourceOfStatus":"SUBSCRIPTION_STATUS","brandId":null,"preferenceGroupName":null,"legalBasis":null,"legalBasisExplanation":null}]}

 

 What can I do now?

Best regards
Gustaf

0 Upvotes
gustafm
Member

Same via the test call on

https://developers.hubspot.com/docs/api/marketing-api/subscriptions-preferences


Section

Get subscription statuses for a contact

emailAdress invalid

 

 

HTTP 200

{
  "recipient": "invalid",
  "subscriptionStatuses": [
    {
      "id": "REDACTED",
      "name": "One to One",
      "description": "One to One emails",
      "status": "SUBSCRIBED",
      "sourceOfStatus": "SUBSCRIPTION_STATUS",
      "brandId": null,
      "preferenceGroupName": null,
      "legalBasis": null,
      "legalBasisExplanation": null
    },
 

 

 

Looks like HubSpot does not even check if the e-mail is syntactically valid (existing hostname). But it is subscribed.

SIZZA
Participant

I'm facing the same situation.

When I create a new contact and check with the API the subscription status (using postman), with this endpoint https://api.hubapi.com/communication-preferences/v3/status/email/{email} I find that this contact is "SUBSCRIBED" to all campains

 

Any advice ?

0 Upvotes
gustafm
Member

If you go to Settings > Data Privacy, check if you have GDPR Tools enabled. If so, the next line “Legal Basis“ needs to be checked, too. Enabling only GDPR Tools without this check will lead to this bug (which is considered a feature by HubSpot).