One Click - List unsubscribe | Community
Skip to main content
Level 5
May 14, 2024
Solved

One Click - List unsubscribe

  • May 14, 2024
  • 2 replies
  • 3355 views

Hi there, 

 

I'm experimenting with implementing a one-click list unsubscribe feature by incorporating the following code into the Additional SMTP header:

List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: <unssublinkfromwebapp?id=<%= recipient.cryptedId %> >, < mailto:<%@ include option='NmsEmail_DefaultErrorAddr' %>?subject=unsubscribe<%=escape(message.mimeMessageId) %> >
 

Although I've utilized the XML file provided on the helpx page, I'm uncertain whether it effectively captures the unsubscribe requests. Is there a method to verify unsubscribes after recipients click on the unsubscribe link in the SMTP header?

I've conducted tests on this feature in Yahoo and Gmail but haven't been able to monitor the status of subscriptions.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ALangridge

Hello! I'd just download and install the XML package that Adobe have put together which is available here: https://experienceleague.adobe.com/en/docs/deliverability-learn/deliverability-best-practice-guide/additional-resources/campaign/acc-technical-recommendations#one-click-list-unsubscribe

This code block is 99% what is in the installed file, but I've got the last few rows at the bottom there to update the recipient. 

 

if (NL.isEmpty(ctx.@secret)) logError("invalid secret..."); var secret = decryptString(ctx.@secret); if (NL.isEmpty(secret)) logError("invalid secret..."); this.secret = JSON.parse(secret); if (NL.isEmpty(this.secret)) logError("invalid secret..."); if (this.secret.method != ctx.@_method || this.secret.identifier != ctx.@_identifier || this.secret.key != ctx.recipient.@_key ) { logError("invalid secret..."); } if( String(ctx.recipient.@id) != decryptString(this.secret.identifier) ) logError("The webApp inputs are corrupted."); // remove descenants @_key to protecte against sql injection var descendantNode = ctx.recipient.descendants(); for (var i = 0; i < descendantNode.length(); i++) { delete descendantNode[i].@_key; delete descendantNode[i].@_operation; } nms.subscription.Unsubscribe(ctx.vars.service, ctx.recipient) //Everything after this line is new var recipient = ctx.recipient; recipient.@xtkschema = "nms:recipient"; recipient.@_operation = "update"; recipient.@_key="@id"; recipient.exportMetadata.@userInitSubDateTime = modifiedDate; recipient.@unsubReason = "Automated - One Click Unsubscribe"; xtk.session.Write(recipient);

 

2 replies

rahulkad29786
Level 4
May 14, 2024

Hi @rvnth ,

Firstly u need to install the One-Click List Unsubscribe xml web-app package provided.
Once installed, u will see an Unsubscribe webapp, post that u need to include the above mentioned 2 lines of List Unsubscribe code and add the same in a typology rule and further add that rule to a typology and apply that typology to  the delivery.

For testing, once u receive the email, u click on the Unsubscribe link in the header of Gmail or Yahoo and then for that recipient the "blacklist" flag will be updated to "Yes" in the recipient schema.
This will confirm that the functionality is working fine.

 

Hope that helps.


Thanks

 

ALangridge
Level 4
May 14, 2024

I tested my implementation by changing the script activity in the web app to also update a text field during processing - for example here's what sits at the bottom of my script activity, which writes "Automated - One Click Unsubscribe" to a "unsubscription reason" field.

var recipient = ctx.recipient; recipient.@xtkschema = "nms:recipient"; recipient.@_operation = "update"; recipient.@_key="@id"; recipient.@unsubReason = "Automated - One Click Unsubscribe"; xtk.session.Write(recipient);

 

HMO
May 22, 2024

Hi @alangridge,

Could you please share the entire script activity ?

 

Thanks,

ALangridge
ALangridgeAccepted solution
Level 4
May 22, 2024

Hello! I'd just download and install the XML package that Adobe have put together which is available here: https://experienceleague.adobe.com/en/docs/deliverability-learn/deliverability-best-practice-guide/additional-resources/campaign/acc-technical-recommendations#one-click-list-unsubscribe

This code block is 99% what is in the installed file, but I've got the last few rows at the bottom there to update the recipient. 

 

if (NL.isEmpty(ctx.@secret)) logError("invalid secret..."); var secret = decryptString(ctx.@secret); if (NL.isEmpty(secret)) logError("invalid secret..."); this.secret = JSON.parse(secret); if (NL.isEmpty(this.secret)) logError("invalid secret..."); if (this.secret.method != ctx.@_method || this.secret.identifier != ctx.@_identifier || this.secret.key != ctx.recipient.@_key ) { logError("invalid secret..."); } if( String(ctx.recipient.@id) != decryptString(this.secret.identifier) ) logError("The webApp inputs are corrupted."); // remove descenants @_key to protecte against sql injection var descendantNode = ctx.recipient.descendants(); for (var i = 0; i < descendantNode.length(); i++) { delete descendantNode[i].@_key; delete descendantNode[i].@_operation; } nms.subscription.Unsubscribe(ctx.vars.service, ctx.recipient) //Everything after this line is new var recipient = ctx.recipient; recipient.@xtkschema = "nms:recipient"; recipient.@_operation = "update"; recipient.@_key="@id"; recipient.exportMetadata.@userInitSubDateTime = modifiedDate; recipient.@unsubReason = "Automated - One Click Unsubscribe"; xtk.session.Write(recipient);