Communication Preferences - "cannot be updated because they have unsubscribed"

Hello,

My use case is as follows: I need to implement a radio button within an application that allows users (who are also in HubSpot) to opt-in and opt-out of marketing emails.

I am attempting to implement this behavior with the following API endpoints:

  • GET /communication-preferences/v3/status/{email}
  • POST /communication-preferences/v3/subscribe
  • POST /communication-preferences/v3/unsubscribe

I am able to check the status and unsubscribe successfully, however when I try to opt-in a user who has previously been unsubscribed, I receive the following error:

{
"status": "error",
"message": "XXX.XXX.XXX is already unsubscribed from subscription 9109168",
"correlationId": "dd9b6eb4-c1c1-45d1-af86-705fdb5a8739",
"category": "VALIDATION_ERROR"
}

If this is not the correct way to implement the behavior I am seeking, what is?

Thanks in advance!

Hi @AG-CC

Once a contact has been unsubscribed, that cannot be resubscribed. Per the documenation here:

The subscribe contact endpoint allows you to subscribe an email address to any given subscription type in an account, but will not allow you to resubscribe contacts who have opted out.

Follow this guide for how to resubscribe a contact

Dennis,

Thank you for your reply! I did see the documentation that you referenced. Just to confirm - you are saying that there is no way to programmatically change a user’s marketing email preference from unsubscribed to subscribed - is that correct?

Thanks,

Bill

Hey Bill,

It is useful the initial subscribing and unsubscribing of a contact. An integration might create a contact and subscribe them to subscribe that contact to something.

And yeah, confirming that you cannot programmatically change to subscribed. Blame the spammers of the world for this. Obviously, not what you want to hear, but I hope it answers your question.

Is there any new update on funcationality to programatically allow a user to set their subscription status from within our mobile application?

We cannot use the `hs_email_optout` field because it’s read only.

I am trying to use the `hubspotClient.communicationPreferences.statusApi` methods.