Expand my Community achievements bar.

Submit delivery via API using classic JS SDK

Avatar

Level 2

Hi can anyone tell what i am doing wrong :

I am trying to submit delivery by usingadobe campaign classic  SDK

code for that:

 

 

const sdk = require('@adobe/acc-js-sdk');

(async () => {
// Display the SDK version
const version = sdk.getSDKVersion();
console.log(`${version.description} version ${version.version}`);

// Logon to a Campaign instance with user and password
const connectionParameters = sdk.ConnectionParameters.ofUserAndPassword("url",
"username", "password");
const client = await sdk.init(connectionParameters);
await client.logon();
const NLWS = client.NLWS;
 
const xml = `<?xml version='1.0' encoding='ISO-8859-1'?>
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:urn='urn:xtk:session'>
<soapenv:Header/>
<soapenv:Body>
<urn:SubmitDelivery>
<urn:sessiontoken>___33ddebcc-4b54-4698-9819-2700d90ae8cd</urn:sessiontoken>
<urn:strScenarioName>DM1882</urn:strScenarioName>
<urn:elemContent>
<delivery xtkschema="nms:delivery">
<scheduling validationMode="auto" />
<targets >
<deliveryTarget>
<targetPart>
<where filteringSchema="nms:recipient">
<condition expr="@email = 'arnav.kumar+1@gmail.com'"/>
</where>
</targetPart>
</deliveryTarget>
</targets >
</delivery>
</urn:elemContent>
</urn:SubmitDelivery>
</soapenv:Body>
</soapenv:Envelope>`;


const deliveryId = await client.nms.delivery.SubmitDelivery("DM1882",xml);

console.log(deliveryId);
})().catch((error) => {
console.log(error);
});
3 Replies

Avatar

Community Advisor

Hello @arnav21 

 

Can you please share more details, like what error you are getting while executing this code?


     Manoj
     Find me on LinkedIn

Avatar

Employee Advisor

Hi @arnav21 ,

It's not clear what the issue is that you're experiencing. Can you please provide more information about the problem you're encountering? Are you seeing any error messages, or is the code not behaving as expected?

Also, it's important to note that it's not recommended to share your username and password in public forums for security reasons. It's better to use environment variables or configuration files to store these sensitive credentials.

Avatar

Administrator

Hi @arnav21,

Were you able to resolve this query on your own or do you still need help here? If you do, then kindly share more details as requested above by @akshaaga & @_Manoj_Kumar_.

Thanks!



Sukrity Wadhwa