- Campaigns and sequence emails built in the editor: add the link in an HTML block, and turn off Show unsubscribe in the footer block if you have one.
- Campaigns created through the API with
html. - Emails sent through the send endpoint
with
emailTypeset tomarketing. Transactional sends have no Sequenzy unsubscribe link, so{{unsubscribeUrl}}is empty there.
1. Link to your page
Add a link to your page in your email. Include two values in the link:- A value that identifies the recipient, so your page knows who clicked. Use a
signed token you store as a custom attribute, such as
{{subscriber.unsubscribe_token}}. Avoid the plain email address: anyone could change it in the URL and unsubscribe someone else. Use only letters, numbers,-and_in the token, because the value is not URL-encoded. If a subscriber has no such attribute, the value is empty. {{unsubscribeUrl}}. This tells Sequenzy your email already has an unsubscribe link, so it does not add its own unsubscribe footer.
sequenzy value is the recipient’s Sequenzy unsubscribe link. Your page
does not need to use it. You can use it as a fallback by redirecting there if
your own page cannot complete the request.
2. Unsubscribe the subscriber from your server
When the subscriber submits your form, look up their email from your token and call Update Subscriber withstatus set
to unsubscribed. The API key needs the subscribers:write scope.
customAttributes in the same request, as shown above. Keep
customAttributesStrategy set to merge. Without it, the answers replace the
subscriber’s other custom attributes.
Unsubscribes made through the API are not linked to the email they came from,
so they do not appear in that email’s unsubscribe stats.
Make this call from your server. Never put your API key in the page itself.
Unsubscribes that skip your page
Gmail, Yahoo, Apple Mail and other inbox providers show their own unsubscribe button next to the sender name. It unsubscribes in one click through theList-Unsubscribe header on marketing emails. Sequenzy always sets this header
to its own one-click link, and you cannot change it, so those subscribers never
see your page.
To keep your own records in sync, listen for the subscriber.unsubscribed
webhook event. It fires whenever a
subscriber becomes unsubscribed, including through the inbox button, the
Sequenzy page and your API call.