Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Sending emails through calling API in javascript

Ramaswami
Level 4
Level 4

Hi Folks, 

 

My task is to send emails through API methods which are available in adobe campaign classic. 

 

I am pulling records from query activity and the next i am placing a javascript node and calling the method : 

 

logInfo(NLWS.nmsDelivery.SubmitDelivery("prdDM30931",""); where prdDM30931 is the delivery template name which i created manually. 

 

this is the method declaration given in documentation. 

Number deliveryId = SubmitDelivery ( String       scenarioName, XML          content )

so i assume something has to be given in 'XML content' section but there is no clear notes what to give there. 

 

my workflow looks like this :

 

Ramaswami_0-1604940932629.png

 

 

i have given a sample xml like the below : 

 

NLWS.nmsDelivery.SubmitDelivery("prdDM30931",<delivery>

<targets>

<deliveryTarget>

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

<where>

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

</where>

</targetPart>

</deliveryTarget>

</targets>

</delivery>)

 

and it throws error saying ctx is not defined. 

3 Replies
Jonathon_wodnicki
Community Advisor
Community Advisor

Hi,

 

There isn't a ctx parameter in the SubmitDelivery method.

If you're trying to recreate Message Center, use SubmitNotification, which has a target param:

 

<delivery>
  <targets>
    <deliveryTarget>
      <targetPart>
        <where>
          <condition expr="@id=123"/>
        </where>
      </targetPart>
    </deliveryTarget>
  </targets>
</delivery>

 

Thanks,

-Jon

Ramaswami
Level 4
Level 4

I just want to send real emails not the notifications through the API function from javascript. 

 

the target will be coming from the query activity and in the api call i need to pass the respondents which i got from query activity. Is there a documentation on how to do that. 

 

i found documentation functions like https://docs.adobe.com/content/help/en/campaign-classic/technicalresources/api/sm-operation-StartDel... 

 

but i want to send delivery by passing respondent emails from query activity through api functions. 

Ramaswami
Level 4
Level 4

Your example :

 

<delivery>
<targets>
<deliveryTarget>
<targetPart>
<where>
<conditionexpr="@id=123"/>
</where>
</targetPart>
</deliveryTarget>
</targets>
</delivery>

 

by the way what is @ID here ( is it the primary key of recipient table? )

 

so can I write like below : 

 

pulling the primary keys from vars.tablename (which is a table generated from query activity) 

var arrayValues=[primary keys OR Email ids];

 

for ( var i=0;i<arrayValues;i++)

{

NLWS.nmsDelivery.SubmitNotification("prdDM30931",<delivery>
<targets>
<deliveryTarget>
<targetPart>
<where>
<condition expr="@id="+arrayValues[i]/>
</where>
</targetPart>
</deliveryTarget>
</targets>
</delivery>)

}

Will this work?