APIs & Integrations

marian2
Member

How to generate the unsubscribe link for a user?

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.

8 Replies 8
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

How to generate the unsubscribe link for a user?

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.

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

How to generate the unsubscribe link for a user?

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

0 Upvotes
pablo_fierro_to
Member

How to generate the unsubscribe link for a user?

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.

0 Upvotes
So_Seductive
Participant

How to generate the unsubscribe link for a user?

It doesn't work now. Any updates?

0 Upvotes
jmichaelTest
Member

How to generate the unsubscribe link for a user?

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

Not applicable

How to generate the unsubscribe link for a user?

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

0 Upvotes
marian2
Member

How to generate the unsubscribe link for a user?

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.

Dadams
HubSpot Employee
HubSpot Employee

How to generate the unsubscribe link for a user?

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.

0 Upvotes