Legacy Dev Forum Posts

 View Only

Sign Up

Get attributes/participant data

  • 1.  Get attributes/participant data

    Posted 06-05-2025 18:46

    Blythewarrior | 2024-06-11 14:16:22 UTC | #1

    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


    Jerome.Saint-Marc | 2024-06-11 14:46:50 UTC | #2

    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 PassedEmail attribute under each participants - `$.participants[*].attributes.PassedEmail` 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,


    Blythewarrior | 2024-06-24 08:41:03 UTC | #3

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


    system | 2024-07-25 08:41:06 UTC | #4

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


    This post was migrated from the old Developer Forum.

    ref: 26701