Expand my Community achievements bar.

Announcing the launch of new sub-community for Campaign Web UI to cater specifically to the needs of Campaign Web UI users!

One Click - List unsubscribe

Avatar

Level 5

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.

4 Replies

Avatar

Level 4

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

 

Avatar

Level 3

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);

 

Avatar

Level 1
Level 1

Hi @ALangridge,

Could you please share the entire script activity ?

 

Thanks,

Avatar

Level 3

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/a...

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);