Get attributes/participant data

Hi
I'm using a data action to retrieve participant data entered email) from a messenger interaction to be used in a survey flow.

The problem I have is I cant for the life of me get the output right - The attribute when run on the API explorer is as below:
participants.attributes.Passed_Email.

Here is my translationmap
{
"translationMap": {
"Email": "$.participants.attributes.Passed_Email"
},
"translationMapDefaults": {
"Email": """"
},
"successTemplate": "{"Email": ${Email}}"
}

Can anyone shed any light please

Hello,

Not sure what API endpoint you are using but I think the following should work (I didn't try it):

{
  "translationMap": {
    "emailArray": "$.participants[*].attributes.Passed_Email"
  },
  "translationMapDefaults": {
    "emailArray": "[]"
  },
  "successTemplate": "{\n   \"Email\": ${successTemplateUtils.firstFromArray(\"${emailArray}\", \"${esc.quote}NOT FOUND${esc.quote}\")} \n}"
}

This JSONPath Expression searches for Passed_Email attribute under each participants - $.participants[*].attributes.Passed_Email
It returns an array of values.

This velocity macro allows extracting the first value from the array (and use the "NOT FOUND" as default value if the attribute is not there).
${successTemplateUtils.firstFromArray(\"${emailArray}\", \"${esc.quote}NOT FOUND${esc.quote}\")}

Regards,

Super thats done the trick - Thank you.
I'm using : /api/v2/conversations/messages/${input.Conversation}

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.