Trouble transforming Webhook data

My difficulty is very similar to this post, however I need to turn the query into a single object with fields for each parameter so I can evaluate it properly in a filter down the workflow. I can get it to return just the query data but it still places the parameters in a single field. I’m guessing because it does not have a json: property. I’m sending the webhook via GET but I thought there might be a way to transform it. I’ve tried the approach mentioned in the post above, but just can’t get it to transform correctly. Webhook data is below:

[
  {
    "body": {},
    "headers": {
      "host": "adastacks.app.n8n.cloud",
      "x-request-id": "cb4aa892a31ff75b9ef35557bda8d68a",
      "x-real-ip": "10.30.0.4",
      "x-forwarded-for": "10.30.0.4",
      "x-forwarded-proto": "https",
      "x-forwarded-host": "adastacks.app.n8n.cloud",
      "x-forwarded-port": "443",
      "x-scheme": "https",
      "accept": "application/json, text/plain, */*",
      "user-agent": "axios/0.18.1",
      "traceparent": "00-5eec62334025fcb0af6b485451a243cc-e69fa864daf3b49b-00",
      "tracestate": "2959370@nr=0-0-2959370-725367163--56a3843f899a8a2a-0-0.249286-1611755280271",
      "newrelic": "eyJ2IjpbMCwxXSwiZCI6eyJ0eSI6IkFwcCIsImFjIjoiMjk1OTM3MCIsImFwIjoiNzI1MzY3MTYzIiwidHgiOiI1NmEzODQzZjg5OWE4YTJhIiwidHIiOiI1ZWVjNjIzMzQwMjVmY2IwYWY2YjQ4NTQ1MWEyNDNjYyIsInByIjowLjI0OTI4Niwic2EiOmZhbHNlLCJ0aSI6MTYxMTc1NTI4MDI3MX19"
    },
    "query": {
      "api_key": "7zPn4ve4J7snNVBnyLUOiDKJ",
      "to_phone": "18643287989",
      "body": "Click here: https://google.com"
    }
  }
]

No need to transform the data. You should be able to reference the data using a expressions and do what you need to. It should be something like {{$node[“webhook”].json[“query”]["api_key"]}}.

Thanks again @RicardoE105 for your speedy response.

I’ve tried using it this way but for some reason the IF filter still does not properly evaluate this value against the array of values from my HTTP request. The IF filter is still only taking the first value to evaluate.
Here is the first IF value:

And here is the second IF value:

Found solution here Loop http Request problem with headers - #2 by RicardoE105

1 Like

Thanks so much @RicardoE105 for your invaluable help! I’m starting to get the hang of it I think!

2 Likes