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
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Adobe Campaign - Delivery connector js for Routing

somasundaramhal
Level 5
Level 5

Team,

We wanted to make use of Delivery and to use Custom Routing method(such as javascript connector) for processing API requests.

- We're trying to integrate other API's in Adobe campaign.

- We're able to connect to those API and send messages using workflows

- Now we want to use Delivery and input targetted addresses in the Delivery target

- Then in the backend we want to process API request using connector

- We tried to use Mobile App push connector for reference. Setting up mobile app channel

- However we failed to complete custom js connector(Attached error image for reference)

- If we execute the same code using workflows, it's working. If I use the same code in connector js, it's not working. Any idea please?

delivery-error-api-connector-js.jpg

The following are the important code snippet in the delivery connector we believe:

loadLibrary("xtk:shared/nl.js");

NL.require('/nl/core/shared/xtk.js')

  .require('/nl/core/shared/js.js');

function processDeliveryPart (deliveryPart) {

  var msgs = <messages/>;

/* API request code comes here */

  return msgs;


//-----------------------------------------------------------------------------

// Useless here, but needed by Neolane

//-----------------------------------------------------------------------------

function getStatus (xml) {

  var msgs = <messages/>;

  return msgs;

}

//-----------------------------------------------------------------------------

// Useless here, but needed by Neolane

//-----------------------------------------------------------------------------

function getMessages (xml) {

  var msgs = <messages/>;

  return msgs;

}

Thanks,

Somasundaram

1 Accepted Solution
DimaKudryavtsev
Correct answer by
Level 4
Level 4

Hi somasundaramhaldurai,

The error means that your JS code is attempting to convert some value into XML, probably, by using E4X. You are absolutely right about that the error originated in your processDeliveryPart function.

Please examine your function and verify that all XML-related code is correct.

If you want more context on where the error have originated, you can add some logInfo() calls into your code. Then open mtachild@<YourInstance> logfile and you will be able to find the log.

View solution in original post

6 Replies
Milan_Vucetic
Community Advisor
Community Advisor

Hi,

do you have function for connecting web service and execution of request?

Also, try to include one more library: loadLibrary("xtk:shared/json2.js");

Could you, please, share full error log from the picture?

Regards,

Milan

somasundaramhal
Level 5
Level 5

Hi Milan,

Thanks for your response. I tried to include the above library as you suggested. But still the same error. I've attached the image of error in the delivery.

Status: Failed

Reason: Unreachable

Targetted address: emGvjpeuMWI:APA91bGgFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Text: Error in delivery part 1220815623: SCR-160025 JavaScript: cannot convert the value to an XML document.\

Note:

If I process the same API request in a workflow, it's working without any issues. The same address can be targetted using a workflow which works fine.

1830621_pastedImage_5.png

Milan_Vucetic
Community Advisor
Community Advisor

Hi,

it seems that this error is returned from your function processDeliveryPart.

Could you, please, check your code inside of this function?

If you have some query inside and result stored to a variable, please check where are you using mentioned variable.

It is not similar problem, but please check this thread regarding error log An issue with creating backup packages

Regards,

Milan

DimaKudryavtsev
Correct answer by
Level 4
Level 4

Hi somasundaramhaldurai,

The error means that your JS code is attempting to convert some value into XML, probably, by using E4X. You are absolutely right about that the error originated in your processDeliveryPart function.

Please examine your function and verify that all XML-related code is correct.

If you want more context on where the error have originated, you can add some logInfo() calls into your code. Then open mtachild@<YourInstance> logfile and you will be able to find the log.

View solution in original post

somasundaramhal
Level 5
Level 5

Thanks so much DimaKudryavtsev​. Your reply saved lot of time for me. I'm in the next step. I'll give an update here once I achieve what I wanted.DimaKudryavtsev

Thanks,

Somasundaram

iambhosale
Level 3
Level 3
In my case I am able to query the target address and send whatsapp messages using Mobile SMS delivery but I am stuck how can I create routing similar to SMS but with channel name as WhatsAPP. Have extended delivery schema and able get whatsapp channel in list but cannot move further