Expandir minha barra de realizações na Comunidade.

Submissions are now open for the 2026 Adobe Experience Maker Awards

Mark Solution

Esta conversa foi bloqueada devido à inatividade. Crie uma nova publicação.

SOLUCIONADO

send a delivery with JS

Avatar

Level 5

How can i send a delivery with Javascript?

 

Example code please.

 

thanks

1 Solução aceita

Avatar

Resposta correta de
Employee Advisor

Hi @alnavarg,

To send a delivery in Adobe Campaign using JavaScript, you can use the SOAP API provided by Adobe Campaign.

Here is an example code snippet to create a delivery:

// Set up the SOAP client

var soap = require('soap');

var url = 'https://example.com/nl/jsp/soaprouter.jsp?wsdl';

var options = {

  forceSoap12Headers: true

};

var client = await soap.createClientAsync(url, options);

// Set up the delivery properties

var delivery = {

  name: 'My Delivery',

  label: 'My Delivery Label',

  startDate: new Date(),

  endDate: new Date(),

  content: {

    type: 'Delivery',

    htmlBody: '<html><body>Hello World!</body></html>'

  }

};

// Create the delivery

var result = await client.createAsync({ delivery: delivery });

console.log(result);

 

This code sets up a SOAP client using the soap library, sets the properties of the delivery, and then calls the createAsync method of the SOAP client to create the delivery.

Note that this is just a basic example and you may need to modify the code depending on your specific requirements and the configuration of your Adobe Campaign instance. 

 

Ver solução na publicação original

4 Respostas

Avatar

Community Advisor

Hi @alnavarg ,

Create a new delivery template and in its property Analysis tab > set approval mode as Automatic.

In workflow JavaScript try below script,

var subjectLine = "Subject Line";
var emailBody = "<html><body><p>Email Body Content</p></body></html>";
var recipientID = "123456789";

var deliveryId = nms.delivery.SubmitDelivery("internalNameOfDeliveryTemplate",<delivery>
<targets >
    <deliveryTarget>
      <targetPart exclusion='false' ignoreDeleteStatus='false'>
        <where>
          <condition expr={'@id ='+recipientID}/>
        </where>
      </targetPart>
    </deliveryTarget>
</targets>

<mailParameters>
     <subject>{subjectLine}</subject>
</mailParameters>

<content>
 <html>
    <source>{emailBody}</source>
 </html>
</content>

</delivery>);

 

Avatar

Level 5

Yes but i want to send it

 

 

Avatar

Community Advisor

The above JS had triggered email to the recipient with primary Key 123456789.

You can modify the where condition to target recipients as per requirement. 

ParthaSarathy_0-1680525903694.png

 

 

Avatar

Resposta correta de
Employee Advisor

Hi @alnavarg,

To send a delivery in Adobe Campaign using JavaScript, you can use the SOAP API provided by Adobe Campaign.

Here is an example code snippet to create a delivery:

// Set up the SOAP client

var soap = require('soap');

var url = 'https://example.com/nl/jsp/soaprouter.jsp?wsdl';

var options = {

  forceSoap12Headers: true

};

var client = await soap.createClientAsync(url, options);

// Set up the delivery properties

var delivery = {

  name: 'My Delivery',

  label: 'My Delivery Label',

  startDate: new Date(),

  endDate: new Date(),

  content: {

    type: 'Delivery',

    htmlBody: '<html><body>Hello World!</body></html>'

  }

};

// Create the delivery

var result = await client.createAsync({ delivery: delivery });

console.log(result);

 

This code sets up a SOAP client using the soap library, sets the properties of the delivery, and then calls the createAsync method of the SOAP client to create the delivery.

Note that this is just a basic example and you may need to modify the code depending on your specific requirements and the configuration of your Adobe Campaign instance.