Handle webhook headers and json data

I’m attempting to implement a Square integration using the Webhook node. Square passes a signature in the HTTP headers, so I need to process that signature before processing the passed-in JSON data.

How do I access the HTTP headers from a Code node? I see that I can use $input to access the passed-in node’s input. Can I use $input.headers[“X-Square-Signature”] ?

I’m running n8n via self-hosting, with port 5678 forwarded so I can view the UI in a browser.

Welcome to the community, @dcasale!

So you’re getting Square to call a webhook in an n8n workflow? In that case the webhook node should put the headers in the output items and you can access them like any other data. See example below.

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