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!

BuildMirror example

Avatar

Community Advisor

Hello dear community,

does anybody have example of

NLWS.nmsDelivery.BuildMirror()

 

I want to get HTML of particular message sent to a recipient.

Marcel

5 Replies

Avatar

Community Advisor

Hi @Marcel_Szimonisz ,

you can use GetMirrorURL functionality.

Workflow:

ParthaSarathy_0-1684386873493.png

Query:

Targeting and filtering dimension as Broad log schema.

In Add data > [delivery/@id] and Alias as @deliveryId

ParthaSarathy_1-1684386952888.png

Javascript:

var data = xtk.queryDef.create(
  <queryDef schema="temp:Query" operation="select" >    
    <select>
      <node expr= "@id" />                   //This is BroadLog ID
      <node expr= "@deliveryId" />           //This is Delivery ID
    </select>
   </queryDef>
)
var output = data.ExecuteQuery();
for each (var file in output.Query)  
{
vars.broadLogId = file.@id;
vars.deliveryId = file.@deliveryId;

vars.url = nms.delivery.GetMirrorURL(vars.deliveryId,vars.broadLogId);
logInfo("Mirror Page URL: " + vars.url);
}

Note: We can generate personalized HTML via mirror page, only if either mirror page is configured in email body or if 'Force the generation of mirror page' option is selected in delivery property's Validity tab.

ParthaSarathy_2-1684387279424.png

To get HTML content without personalization, we can fetch HTML from nms:delivery schema > data > configure list > [content/html/source]

Avatar

Community Advisor

Hello @ParthaSarathy ,
yes i know this part. I need personalized message sent to recipient not source code of template. One way to do it is to grap mirror page content with get request.. but i do not or cannot whitelist the url. I found the function that does what i want called BuildMirror() but. i have no idea how to implement it

Avatar

Community Advisor

Hello All,
I did some progress on the build mirror HTML

 

Do not know what is the difference between the two:

Found that the crypted argument is taken from the mirror page url query parameter c

 

 

05/30/2023 9:33:45 AM   js    ["",400]
05/30/2023 9:33:45 AM   js    Invalid or missing parameter 'c': Unable to generate the mirror page.
05/30/2023 9:33:45 AM   js    XTK-170052 Error during DES decryption for the value '%40HRAtfPMHRfSJYzifZQP9d6qAb%2F%2Fidazr%2Fk9e1EfB4HA%3D'.
05/30/2023 9:33:45 AM   js    prod_%40HRAtfPMHRfSJYzifZQP9d6qAb%2F%2Fidazr%2Fk9e1EfB4HA%3D // c paramt from mirror page url?

 

 

 I have seen implementation of this function but they did not encode the 'c' param at all they grabbed it from url and passed it to the function.

Any ideas? 

Summonig the elders
@Jonathon_wodnicki @costa_n11 @Manoj_Kumar_ @Milan_Vucetic @Craig_Thonis @david--garcia @Denis_Bozonnet 
@Sukrity_Wadhwa  is possible for you to ask internally?

Marcel

Avatar

Employee

Hi @Marcel_Szimonisz 

You won't be able to use these 2 functions as you won't have the delivery part identifier which generated during the execution of the delivery and then discarded. 

 

a solution was provided above from @ParthaSarathy did it not work?
Be aware that mirror page expires after 60 days (configurable in the delivery) 

Did it not help?

Thanks

Denis

Avatar

Community Advisor

Hello @costa_n11 ,

thanks for joining the party. The GetMirrorURL works fine. But I want to have html content as response. I could get the url contents with request but its  no go due to not having access to configuration and to levarage over the settings at all.

The two mentioned functions take as argument "c" paramter from the mirror page URL. If you look at the m.jsp implementation, that is part of the mirror page url, you can see they use BuildMirrorEx and passing c parameter as is from query params to the function and second argument is parameters xml that can be empty.

But somehow when I pass it it does not work. .I might be missing something here.


Marcel