Hello I have some questions regarding the new deliverability good practice
https://experienceleague.adobe.com/en/docs/deliverability-learn/deliverability-best-practice-guide/a...
I have loaded the code mentioned on the page above.
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
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hello @Marcel_Szimonisz ,
I've downloaded the package and installed it on the local server. Here's what I found:
Web App Overview: The web app appears to have three main activities: Preloading, Script, and End Activity.
App URL: The URL for the app is:
https://adobesandboxServerURL.com/webApp/unsubNoClick?id=<%= escapeUrl(cryptString(recipient.id)) %>
API Call and Variable Creation: When you call this API, the Preloading activity creates a CTX variable named ctx.@secret
. This variable is based on the encrypted recipient ID and stores an array of values. It then passes this variable to the next Script activity.This contains the recipient full information which is use in the script activity.
Hope it will help.
Thanks,
Parvesh
Views
Replies
Total Likes
Hello @Parvesh_Parmarm,
thanks for your time spent on this. For me its kind of a mistery. Why the secret ctx is created in preloading, what is in there? what is ctx._method?
I could not find it anywhere set.
Marcel
Views
Replies
Total Likes
Hello @Marcel_Szimonisz ,
If you run this webapp in debug mode, you could check the value:
PFA: Screenshot
CTX Data: There you can find all the variables.
<ctx _console="1" lang="en" score="0" date="2024-05-22T11:30:26Z" _target="web" webApp-id="17921" origin="neolane" _folderModel="nmsRecipient" _identifier="@LBixjPbMZSptbFtzQegCcA==" _method="encryptedId" secret="@/2smQF+ypWCnYdIgQZEkwekKsLiH4TWkj6Z6WTli0oet+udV70f8SywwmE3hpUNTL4dJ/Dfidr9MwhZ6y9m+pbX9CcyMy2lCReZVyLgK+64ykkM0N/s5/TS/PKvwM2omHLL9PJg7h1N7kgS+SfRWqbufXC0D2yHgsIq/hm1wC00=" activityHist="@GuYcHLU8/iMaCBBS60D1+lv157nxFv0byINt7MA0DWbgnYPI33K9FhcdeRBdgPARBykP1CV0UWbwmqx4gEANjP4ukH3pntT2HePhDvlxeWZJbOhEO0TfdZjS7pZphUgI6byKGllUGEwiGoba7QMzdk+Z9kMEvpdYzccRnEyDTCXpKz+62Rzoqt0g40VrQVJC5zhK2/1D+u1bESgggq6Dup7iQA72ZC6/D5L8dE4142c=">
<userInfo datakitInDatabase="true" homeDir="" instanceLocale="en-GB" locale="en-GB" login="webapp" loginCS="Web applications agent (webapp)" loginId="1598" noConsoleCnx="true" orgUnitId="0" theme="" timezone="Europe/Paris" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="urn:xtk:session" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<login-right right="webapp"/>
</userInfo>
<timezone current="Europe/Paris" changed="false"/>
<recipient id="1002" _operation="update" _key="@id"/>
<activityHistory>
<activity name="end" type="end"/>
<activity name="script" type="script"/>
<activity name="prefill" type="prefill"/>
</activityHistory>
</ctx>
As you can check ctx._method="encryptedId"
I don't think Adobe will explain how they calculate these values within the preloading activity.
Kr,
Parvesh
Views
Replies
Total Likes
Did the information provided by @Parvesh_Parmar helped you in your understanding of this issue or do you still need more help here? Do let us know.
Thanks!
Views
Replies
Total Likes