How to generate the unsubscribe link for a user?


#1

We’d like to offer the “unsubscribe” (or “manage subscriptions”) link known from emails to our users in a web interface.

The link looks like this roughly, broken down by (trunkated) URL parameters:

http://info.giantswarm.io/hs/manage-preferences/unsubscribe?
&v=1
&d=eyJlYSI6Im1h...
&utm_campaign=User+Emails
&utm_source=hs_email
&utm_medium=email
&utm_content=2
&_hsenc=p2ANqtz...
&_hsmi=2

How can I generate a valid link like this with the help of the API functions? Thanks.


#2

Hi @marian

We don’t currently have a way to generate an unsubscribe URL for a contact. It’s something that we’re considering as something we’ll add in the future but there are no specific plans yet.


#3

Thanks for your reply.

That’s a pitty. Together with the fact that it’s not possible to subscribe users to email types via the API (see Has anyone tried to build a custom email preference page?), this creates some pretty big user experience obstacles for us.


#5

Hi @dadams ,

We are also looking forward to the option to either subscribe users to email types via API or else generate an unsubscribe URL.
Since this post was in Aug 2016, is there a chance that the feature to generate an unsubscribe link has been implementd in HubSpot by now?

Thanks,
Johnson


#6

Checking in on this in 2018. Has this functionality been added yet?


#7

Hi @Dexter_Peters,

You can create a static user-agnostic unsubscribe link by taking your primary HubSpot email domain and adding the following at the end: /hs/manage-preferences/unsubscribe-simple


#8

Hi Derek,

I know it's possible to generate an unsubscribe link, exactly the link that is generated on marketing emails, for users by doing the following:

Base64 encode this JSON document:
{"ea": "USER@email.com"}

Pass the encoded string to the ?d query param for our subscription page, this successfully loads the subscription preferences for USER@email.com.

I was wondering if this is documented somewhere so we don't implement this in a way that might be changed in the future.

Thanks.


#9

Hi @pablo.fierro.toptal,

That's intentionally undocumented; access to a contact's subscription management page is tightly controlled, and the mechanism is subject to change at any time. I'd advise against depending on that behavior going forward, since we use it internally and it's likely to change without notice.