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

The 4th edition of the Campaign Community Lens newsletter is out now!

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);
});
2 Replies

Avatar

Community Advisor

Hello @arnav21 

 

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

Avatar

Employee

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.