Can I pass values in the body root instead of through inArguments with Marketing Cloud Custom Activity

24 Views Asked by At

We built a custom activity POST in Journey Builder. It works as designed, connects to our API and passes field:value pairs like a typical REST POST. However it works because we hard code values in the config.json body for testing purpose. The actual values we want to read are being passed as inArguments.

"arguments": {
    "execute": {
        "inArguments":[],
        "outArguments": [],
        "url": "https://myurl.m.pipedream.net/",
        "verb": "POST",
        "body": "{\"de\": \"SurveyURLs\",\"emailKey\": \"[email protected]\",\"surveyId\": \"SV_cWUnMW\",\"firstName\": \"Jane\",\"lastName\": \"Smith\"}",
        "headers": "{\"x-api-key\": \"xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx\"}",
        "timeout": 20000,
        "retryCount": 5,
        "retryDelay": 10000
    }
},

The dynamic payload built in customActivity.js adds the field:value pairs to the inArguments array as seems to be standard practice. And we do see the values passed along as expected in the inArguments.

payload['arguments'].execute.inArguments = [{
  "subscriberKey": "{{Contact.Key}}",
  "surveyID": surveyID,
  "de":de,
  "firstName":"{{Event.AutomationAud-myInstance.firstName}}",
  "lastName":"{{Event.AutomationAud-myInstance.lastName}}",
  "accountID":"{{Event.AutomationAud-myInstance.accountID}}"
}]; 

Our API isn't built to parse through inArguments for the payload. Is it possible to attach the data to body instead of body{inArguments[]} ?

We have tried different combinations of: payload['arguments'].execute.body =[{JSON}]; with hope that the payload would pass along in the post body, but the activity does not pass validation. Combinations that do pass validation fail to build the POST when a contact goes through the journey; Hard Error.

0

There are 0 best solutions below