Highlighted

Send an email to a visitor (NOT Recipient, NOT list)

salvdangelo

19-02-2018

Hi,

Anyone could explain me step-by-step how to send a recurring email to visitors IF

I cannot use nms:recipient

I cannot use lists

I will receive through a SOAP request:

- the MCID of the user (stored in vars.mbox in the workflow)

- the email of the user  (stored in vars.email in the workflow)

Probably it's simple,  but I cannot figure out how to do this.

Thanks in advance,
Salvatore

Jean-Serge Biron

dattarays70361342

inactiveforumnotifier

Amy_Wong

Debbie

clawson

mghalpin

Jochem van Dieten

Replies

Highlighted

dattarays703613

19-02-2018

- By recurring email, using SOAP request, I believe you mean: external system will trigger the SOAP API (recurring) which should trigger email (without referring to any nms:recipient record/list)

You can use Message Center API (PushEvent), which dont look up to DB but triggers the email directly; example -

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:nms:rtEvent">

   <soapenv:Header/>

   <soapenv:Body>

      <urn:PushEvent>

         <urn:sessiontoken>12345</urn:sessiontoken>

          <urn:domEvent>

           <rtEvent type="xxxx" email="yyyy@gmail.com" wishedChannel="0">

            <ctx>

            <firstName>zzz</firstName>

            <otp>12345678</otp>

            </ctx>

          </rtEvent>

         </urn:domEvent>

      </urn:PushEvent>

   </soapenv:Body>

</soapenv:Envelope>

Where,

12345=sessionToken which you will get through Logon() API

type="xxxx": Transaction Message Template for email you should publish on Message Center (before you start using it in SOAP API)

Not sure if your requirement was something else?

Highlighted

salvdangelo

19-02-2018

Hi dattarays70361342

I cannot use the Message Center since I have to make a REST call to Adobe Target and replace the response inside the delivery template.
In other words, I am supposed to use a workflow in any case.

Salvatore

Highlighted

dattarays703613

19-02-2018

Hi,

From the workflow, you could invoke Message Center API to trigger emails, example:

var ctxDynamicTag = <ctx />

ctxDynamicTag.appendChild(<tagName>{tagValue}<tagName/>) //your dynamic content if you want to read within delivery template at run time e.g. personalisation details

   

var mcLogin = logonWithUser("mc","mc")

     nms.rtEvent.PushEvent(<rtEvent type={vars.event_type} email={vars.recipientEmail} wishedChannel="0">

                                             {ctxDynamicTag}

                                         </rtEvent>)

Highlighted

Jean-Serge_Biro

MVP

19-02-2018

Hi Salvatore,

Not sure to fully understand, sorry. But I will try to give some ideas, in addition of dattarays70361342​ accurate answer.

Il you need triggered mails raised by external events, but not by using Message Center, please have a look on pipeline mechanism, in case you use Adobe Analytics (Omniture) for tagging your web site(s):

How to use Marketing Cloud Triggers with Adobe Campaign

Otherwise, you can implement submitNotification method with a workflow with a loop for managing incoming records in a specific table (with custom delivery mapping). The submitNotification method is the one use by Message Center. It means reproducing more or less the basics of Message Center; of course keep it simple otherwise it would be an heavy task...

Regarding MCID (visitor ID or Declared ID, I don't know for your case; but visitor ID needs recipients schema, I think). Perhaps you can use nms:visitor in your use case.


Regards
J-Serge

Highlighted

salvdangelo

20-02-2018

Hi Jean-Serge,

We won't use Adobe Analytics for the incoming trigger, but this "submitNotification" seems a good option.

Can you explain me, how should I use this method with a simple example?

I never used API in Adobe Campaign.

Highlighted

Jean-Serge_Biro

MVP

20-02-2018

Hi Salvatore,

Do your company own JSAPI.chm documentation? It is subject to license so we can't share it as is here. Please contact your Adobe salesman if you don't have the license. If you have it, claim to Adobe support to put the JSAPI.chm file it in the download section on your Adobe support extranet.

(Personnally I still don't understand why it don't come as a web site pages documentation rather than a Windows help file, it is not convenient at all to get updates...)

Take care, in workflow you can use submitNotification for continuous deliveries to add new target (contacts) without changing the scenario/delivery template (that seems your use case), rather than submitDelivery that is used for normal deliveries (more "powerful" because allow to change the template elements but more resource-consumption).

And there is also queueNotification, very close to submitNotification, that you can use as well to add targets to a delivery.

The 3 syntax are similar but the method to use depends on your requirement.

Basically, the way to manage submitNotification is as in this sample code:

1423060_pastedImage_4.png

FYI, you can also call this kind of method within a webApp workflow Javascript activity, in that case use ctx xml element as the context:

nms.delivery.QueueNotification('yourTemplateDelivery',

<delivery>

<targets>

  <deliveryTarget>

    <targetPart type='query' exclusion='false' ignoreDeleteStatus='false'>

      <where>

        <condition expr={'@id ='+ ctx.recipient.@id}/>

      </where>

    </targetPart>

  </deliveryTarget>

</targets>

</delivery>);

Regards
JS

Highlighted

salvdangelo

21-02-2018

Hi Jean-Serge,

First question

Suppose that I have the email of the customer contained in a global variable: vars.email and I should use the method you suggest.
How should I apply this?

I guess something like this:

nms.delivery.SubmitNotification('myTemplateDelivery',

<delivery>

<targets>

     vars.email

</targets>

</delivery>);

Note that I am not sure that THIS email might belong to a recipient so I have to insert the email as is, without any filter.

Second question.

I need to modify the template before sending it.
In particular I need to replace this HTML <div id="specialDiv"></div> with an HTML I will receive from Adobe Target (stored in vars.modifiedhtml)
How should I do this thing ?

I know that I ask you so much but still don't know how to proceed.
I read all the documentation you both were referring to but this didn't help me so much.

Thanks,
Salvatore

Highlighted

salvdangelo

21-02-2018

@Jean-Serge Sorry, if I keep bothering you, but I am trying to use the Message Center method that you both have suggested above.

1424629_pastedImage_0.png

In "Call MESSAGE CENTER" script I can successfully send a transactional (message center) message if I exclude vars.template (that contains an HTML template that I receive from an external source).

But if a use vars.template the function postEventMessageCenter fails (TypeError: unknown XML entity nbsp)

// SCRIPT of "Call MESSAGE CENTER"

vars.eventType = "BackInStock_"+vars.locale;

logInfo("EVENT TYPE: "+vars.eventType);                                                        

function postEventMessageCenter(eventType,email,productName, productId, productModel, productImgUrl, template)

{             

              var mcLogin = logonWithUser("mc","4Q6DuWTP3uof");

              var ctx = "<rtEvent type='"+eventType+"' email='"+ email +"'>";                    

                  

                    ctx += "<ctx>";

                    ctx +=   "<productName>"+ productName +"</productName>";

                    ctx +=    "<emailAddress>" + email+ "</emailAddress>";

                    ctx +=    "<productId>" + productId + "</productId>";

                    ctx +=    "<productModel>" + productModel + "</productModel>";

                    ctx +=    "<productImgUrl>" + productImgUrl + "</productImgUrl>";

                    ctx +=    "<template>" +template+"</template>"; 

                    ctx +=  "</ctx>";

                    ctx +=  "</rtEvent>";                 

                  

                    var rtEventId = nms.rtEvent.PushEvent(new XML(ctx));                 

                 

                    logInfo("event if fired"+rtEventId);

}

var error = 0;

try{ 

  postEventMessageCenter(vars.eventType,vars.email,vars.productName, vars.productId, vars.productModel, vars.productImgUrl, vars.template);

  error = 0;

}catch(e){

  logWarning("TYPE OF ERROR: "+e);

  error = 1;

}

logInfo(error);

//END OF CODE

How do I may inject the HTML template (vars.template) if I pass it through Message Center call above?

Thanks in advance!

Salvatore