Get a value from a webhook header

Hi everyone!

I’m trying to get the value “user-agent” from a webhook header.

I was following this example, but I’m not able to get the value:

I’m having this error:
Captura de pantalla 2023-05-10 a la(s) 23.03.26

This is my function:

{{get(map(HEADERSARRAY; “value”; “name”; “user-agent”); 8)}}

I appreciate any help.
Thanks!

Hi @Juani

You don’t need to add double quotes.
Also, assuming there’s only one header with name user-agent, you’ll be getting an array with just one element, so use the get function with param 1 instead of 8.

Please try this:
{{get(map(HEADERSARRAY;value;name;user-agent); 1)}}

2 Likes

Hi @Loopz , thank you for your answer.
Double quotes are just from the copy-paste but they weren’t there in the formula.
I tried with param 1 instead of 8, same error.

I thought that number was the position in the array. It’s definitely only 1 user-agent per webhook.

As you can see in the first picture, I have an Array of 19 items and each one is a collection.
Position number 8 of the array contains a collection, that has the name and value that I’m looking for.

I figured it out and I just get that value like this and it works:

Anyway, I would love to know how to make a “search” or “filter” the array and get the value by the name and not by the position of the array…

Thanks

Do not put a number for the array, as you can’t be sure about the position of that specific header in the list of headers.

Have you tried to extract the user agent with this formula?
{{get(map(HEADERSARRAY;value;name;user-agent); 1)}}

1 Like

Yes, that was I tried to said… I tried your formula with the 1, same error {collection,collection…}.

I’m sorry I missed that.

I’m confused about this:


A part of the screenshot refers to module 9, which I don’t see on the screenshot

Can you please share additional screenshots:

  • 1 from the whole scenario layout
  • 1 that shows the error the way it’s displayed in Make without cropping context
2 Likes

“module 1” reference was a screenshot from an example that I was following:
https://www.make.com/en/help/tools/webhooks#webhook-headers

I’m sorry @Loopz, but this actually works:

Solution:

I don’t know why, when I attempted I didn’t realize that was actually working.

Thank you so much!!

1 Like

You’re welcome! Please mark the answer that helped you as the solution. Thanks!

1 Like