Grab Tally form answers

Describe the problem/error/question

Hello,

I’m trying to create a new workflow to grab Tally answers and add them to a Jira ticket.

My problem is when I have multiple choices questions, the answers are coded with the value of the option proposed.

For example, I’ll have answers value = 8ededb54-2878-422c-a850-8678402bdbd9

And then I have to review the different options to know which one has been selected.

I heard about the Jmespath syntax that can help with this, but I don’t know how to use it… I asked ChatGPT but it looks like it is not successful!

Could you help me? :slight_smile:

Here is my JSON:


{
"key":
"question_mRkzY4",
"label":
"Where did you find about this job opportunity?",
"type":
"MULTIPLE_CHOICE",
"value":
"8ededb54-2878-422c-a850-8678402bdbd9",
"options":
[
{
"id":
"8ededb54-2878-422c-a850-8678402bdbd9",
"text":
"corporate website"
},
{
"id":
"e384a1b2-920b-487d-b084-526a5d1e120d",
"text":
"Career Fair"
},
{
"id":
"4616264a-fdf1-4ac4-bda9-59e63185269a",
"text":
"university Website"
},
{
"id":
"21aaaf06-4cd4-40be-a1d4-74e8dbc91478",
"text":
"Indeed"
},
{
"id":
"e0827a43-8a7e-40fb-b27b-c4d6ba7242af",
"text":
"Linkedin"
},
{
"id":
"b180ac6b-2f96-49f2-83e8-e89647b47c83",
"text":
"Net-Empregos"
}
]
},

Here are my latest test:

{{ $jmespath($json.body.data.fields[3].options[?id=='8ededb54-2878-422c-a850-8678402bdbd9'.text | [0] ) }}

And this one to not har coded the value:

{{ $jmespath($json.body.data.fields[3].options"[?id==' $json["body"]["data"]["fields"][3]["value"]'].text" | [0] ) }}

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 0.219.1
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu

Hi @Tanguy, welcome to the community :tada:

Thx a lot for sharing your data structure! It doesn’t seem complete though, as there don’t seem to be any body or data fields. In n8n’s JSON view, can you make sure to

  1. Select the topmost level of your JSON data
  2. Click the Copy button
  3. Pick “Copy Selection”

Like so:

This would copy the full JSON data which you can then paste here on the forum. Everything confidential can of course be redacted, it’d just be important to keep the data structure itself unchanged.

Thank you!

Hi @Tanguy, following up on my last message I just gave Tally forms a go on my side to grab an example payload.

Here’s a dummy workflow extracting the text of the chosen multiple choice value:

You’d need to add the key of your own multiple choice question, but I think this should work for you as well in principle and leaves you with a single value in the end:

Hello @MutedJam

First of all, thanks a lot for your help regarding this subject!

Unfortunately, I’m very bad and still can’t make it work…

Here is my JSON :

[
  {
    "headers": {
      "host": "automation8n.domain.com",
      "connection": "close",
      "x-real-ip": "xxxxx",
      "x-forwarded-for": "xxxx",
      "x-forwarded-proto": "https",
      "content-length": "3842",
      "cf-connecting-ip": "xxxx",
      "cf-ipcountry": "US",
      "accept-encoding": "gzip",
      "cf-ray": "7de4e1f79ba67773-LHR",
      "cf-visitor": "{\"scheme\":\"https\"}",
      "accept": "application/json, text/plain, */*",
      "content-type": "application/json",
      "user-agent": "Tally Webhooks",
      "cdn-loop": "xxx"
    },
    "params": {},
    "query": {},
    "body": {
      "eventId": "8dbe84c1-9c44-40a2-a95b-5d1c8877ba33",
      "eventType": "FORM_RESPONSE",
      "createdAt": "2023-06-21T14:25:35.657Z",
      "data": {
        "responseId": "RDDMb9",
        "submissionId": "RDDMb9",
        "respondentId": "QoPVy1",
        "formId": "nrDKev",
        "formName": "xxxxx job application",
        "createdAt": "2023-06-21T14:25:35.000Z",
        "fields": [
          {
            "key": "question_3jvBWQ",
            "label": "First Name",
            "type": "INPUT_TEXT",
            "value": "Tanguy"
          },
          {
            "key": "question_w274ve",
            "label": "Last Name",
            "type": "INPUT_TEXT",
            "value": "XXXX"
          },
          {
            "key": "question_3xvdyd",
            "label": "Email",
            "type": "INPUT_EMAIL",
            "value": "XXXXX"
          },
          {
            "key": "question_mRkzY4",
            "label": "Where did you find about this job opportunity?",
            "type": "MULTIPLE_CHOICE",
            "value": "8ededb54-2878-422c-a850-8678402bdbd9",
            "options": [
              {
                "id": "8ededb54-2878-422c-a850-8678402bdbd9",
                "text": "Corporate website"
              },
              {
                "id": "e384a1b2-920b-487d-b084-526a5d1e120d",
                "text": "Career Fair"
              },
              {
                "id": "4616264a-fdf1-4ac4-bda9-59e63185269a",
                "text": "university Website"
              },
              {
                "id": "21aaaf06-4cd4-40be-a1d4-74e8dbc91478",
                "text": "Indeed"
              },
              {
                "id": "e0827a43-8a7e-40fb-b27b-c4d6ba7242af",
                "text": "Linkedin"
              },
              {
                "id": "b180ac6b-2f96-49f2-83e8-e89647b47c83",
                "text": "Net-Empregos"
              }
            ]
          },
          {
            "key": "question_wovAdO",
            "label": "Which University Website.",
            "type": "INPUT_TEXT",
            "value": null
          },
          {
            "key": "question_nG5rDL",
            "label": "What are you applying for?",
            "type": "MULTIPLE_CHOICE",
            "value": "588f2080-1387-42ff-8efd-8adbf6959487",
            "options": [
              {
                "id": "588f2080-1387-42ff-8efd-8adbf6959487",
                "text": "Full time contract"
              },
              {
                "id": "848fe09d-ca27-428f-b19d-702486dd869c",
                "text": "VIE Contract"
              },
              {
                "id": "03e0b3b6-324f-4b3c-b82c-e6a0092b9ad9",
                "text": "Internship"
              },
              {
                "id": "1ec0d4f4-bc75-48dc-b7c8-7746270e3ed6",
                "text": "Full Time -  French Speaker"
              }
            ]
          },
          {
            "key": "question_mOkAYY",
            "label": "Have you completed the following level of education: Bachelor's Degree?",
            "type": "MULTIPLE_CHOICE",
            "value": "a9ac4700-415c-467e-a8b5-1d88aea1a2ca",
            "options": [
              {
                "id": "a9ac4700-415c-467e-a8b5-1d88aea1a2ca",
                "text": "Yes"
              },
              {
                "id": "1072230a-5f23-483c-9512-f8deba8fadf3",
                "text": "No"
              }
            ]
          },
          {
            "key": "question_mVDZYM",
            "label": "What is your level of proficiency in English?",
            "type": "MULTIPLE_CHOICE",
            "value": "7926551d-9f13-4d86-a7e7-4894d63dfa2c",
            "options": [
              {
                "id": "7926551d-9f13-4d86-a7e7-4894d63dfa2c",
                "text": "None"
              },
              {
                "id": "78b56e64-db49-41f4-b892-13fca8c09a38",
                "text": "Conversational"
              },
              {
                "id": "34f17ae4-d033-4eb2-a41d-2f3eee148c80",
                "text": "Professional"
              },
              {
                "id": "38a1a550-75db-4ec0-be0f-292ef53e7e60",
                "text": "Native / Bilingual"
              }
            ]
          },
          {
            "key": "question_nPkAYB",
            "label": "Are you legally authorized to work in Europe?",
            "type": "MULTIPLE_CHOICE",
            "value": "7ce14170-e383-4e58-a09b-bece4353a23b",
            "options": [
              {
                "id": "7ce14170-e383-4e58-a09b-bece4353a23b",
                "text": "Yes"
              },
              {
                "id": "2951b584-1c54-457b-a2ab-100bc5607179",
                "text": "No"
              }
            ]
          },
          {
            "key": "question_3EMPDB",
            "label": "Are you confortable commuting to this job's location?",
            "type": "MULTIPLE_CHOICE",
            "value": "5d7034d0-a29a-4e3f-8e86-d74ba81bcec2",
            "options": [
              {
                "id": "5d7034d0-a29a-4e3f-8e86-d74ba81bcec2",
                "text": "Yes"
              },
              {
                "id": "8fca48df-78cc-4bd2-8fca-31ccbf4ddeef",
                "text": "No"
              }
            ]
          },
          {
            "key": "question_nrvlL2",
            "label": "When is you desired start date?",
            "type": "INPUT_DATE",
            "value": "2023-06-22"
          },
          {
            "key": "question_wLkdNO",
            "label": "Please send Your CV",
            "type": "FILE_UPLOAD",
            "value": [
              {
                "id": "2EJr9A",
                "name": "livre_blanc.docx",
                "url": "https://storage.googleapis.com/tally-response-assets/BG1GOQ/7878245e-ceb0-4fb3-8649-10aeec85424b/livre_blanc.docx",
                "mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
                "size": 730605
              }
            ]
          },
          {
            "key": "question_npvL1Z",
            "label": "Please send us your Cover Letter",
            "type": "FILE_UPLOAD",
            "value": [
              {
                "id": "xXPZ8J",
                "name": "livre_blanc.docx",
                "url": "https://storage.googleapis.com/tally-response-assets/BG1GOQ/0327e3f8-72c5-40fe-a536-47b9f4601b20/livre_blanc.docx",
                "mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
                "size": 730605
              }
            ]
          }
        ]
      }
    }
  }
]

Following your recommendations, I tried this one :

{{ $jmespath($json["body.data.fields[3]"]["option"], "[?id =='"+ $json["body.data.fields[3]"]["value"] + "'] | [0].text") }}

But the result remain [undefined]

Thanks once again for all the help you can provide!

Hi @Tanguy, have you tried copying the nodes I have share in my last messages? After adding your data to the example workflow I’ve provided and updating the question key I am getting this result:

First Set node:

Second Set node:

This is the full workflow, you should be able to simply copy the part after my “Mock data” node and add it after your webhook node:

Can you give this a go and let me know if you are still seeing any issues?

Hooo ! It works :slight_smile:

Sorry, I read a bit too fast your first message…

As you may have seen I have 6 multiple choices on my Tally. I guess it means that I need in total 12 set nodes? 6 for extract possible choices, and 6 to find the correct answer correct?

Thanks again

1 Like

You can define multiple fields in your Set nodes so wouldn’t need additional nodes. Simply make sure to use a unique name for each and provide the correct question key :slight_smile:

It’s OK, all running perfectly !

Thanks a lot for your help :slight_smile:

It is my second workflow going live, I definitely need to improve my skills !

1 Like

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