APIs & Integrations

Shakil
Participant

Update email subscription status for an email address is not working

Hello there,

I was just trying to add a subscription for an email address using this api https://developers.hubspot.com/docs/methods/email/update_status link. I am getting success response from the api and it is stdClass Object ( [success] => 1, [code] => 200). Unfortunately which is not working properly. On the email address activity timeline I got "Test Test (testing@test.com) communication subscriptions changed,
ago 7 at 14:31 GMT+2, Subscribed to the examplesubscription subscription". But the communication subscriptions sidebar not changed. Also when I use the api call to https://developers.hubspot.com/docs/methods/email/get_status , I am getting subscribed false. What would be the possible reason for strange behavior? Below the image illustrates the issue broadly.

When I am calling the endpoint https://developers.hubspot.com/docs/methods/email/get_status I am getting

stdClass Object
(
    [subscribed] => 1
    [markedAsSpam] => 
    [unsubscribeFromPortal] => 
    [portalId] => portalIdHere
    [bounced] => 
    [email] => testing@test.com
    [subscriptionStatuses] => Array
        (
            [0] => stdClass Object
                (
                    [id] => subscriptionIdHere
                    [updatedAt] => 1533889177929
                    [subscribed] => 
                    [optState] => NOT_OPTED
                    [legalBasis] => PERFORMANCE_OF_CONTRACT
                    [legalBasisExplanation] => We need to send them these emails as part of our agreement with them.
                )

        )

    [status] => subscribed
)

Many many thanks.

0 Upvotes
3 Replies 3
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Update email subscription status for an email address is not working

Hi @Shakil and @Fabian_Zolk,

Apologies for the lengthy delay here; I missed this post and it got swept away by other more recent posts. I'm not able to reproduce this issue in my own portal; can one or both of you send me a link to an example contact in that is showing this issue?

0 Upvotes
Shakil
Participant

Update email subscription status for an email address is not working

Thank you for your response and the issue is solved now. There was a parameter missing before in the documentation. Now its up to date. FYI documentation url is https://developers.hubspot.com/docs/methods/email/update_status and the parameter was missing is optState.

fabianj
Contributor

Update email subscription status for an email address is not working

I confirm the issue and additionally one more detail, if you create a Contacts -> List that filters for contacts with the subscription type the contact was subscribed to via API, that contact won't show up. Meaning that HubSpot does not recognize the contact as subscribed to that subscription type even though it's showing up on the contacts activity timeline.

0 Upvotes