Question
no-click unsubscribe web app code explanation
Hello I have some questions regarding the new deliverability good practice
https://experienceleague.adobe.com/en/docs/deliverability-learn/deliverability-best-practice-guide/additional-resources/campaign/acc-technical-recommendations
I have loaded the code mentioned on the page above.
- Can somebody explain where the ctx.@secret is created and how I set ctx.@_method? It is supposed to be POST based on the article. I could not find any specific settings on properties of the web app not we do not add except recipient id anything to the no-click unsub link.
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)
Kind regards,
Marcel
