HMAC SHA256 webhook secret (concatenate timestamp)

N8N doesn’t have the option to append a timestamp 1767973468 to the binary data (Raw Body Webhook) to get data in the format 1767973468.{“event”:“test”,“timestamp”:“2026-01-09T15:44:28Z”,“data”:{“message”:“This is a test webhook from ChainWatch”,“merchant_id”:12}}

What’s a simpler way to merge the data?

And why is it so difficult to attach a timestamp to a binary file?

1767973468.{“event”:“test”,“timestamp”:“2026-01-09T15:44:28Z”,“data”:{“message”:“This is a test webhook from ChainWatch”,“merchant_id”:12}}

+

48cb8a3db08d34327645f65038f527d844068ee54bb28c31047d949ab87435b8

=

b2a55065274c66ed75238e1b5b7dbd94526332065e1fe3670206d6aff822821a

Hi @SKYsource, welcome!

You can use a Set node expression:

{{ $json.headers['x-chainwatch-timestamp'] + '.' + $json.body.toJsonString() }}

Here’s a simpler version of your workflow:

I tested this myself with a trial Chainwatch account, and it works, so change all secrets in the workflow with yours,

Hope this helps!

2 Likes

I’m grateful to you, thank you!
I was missing this: toJsonString()
Your hint helped me reduce the number of nodes

Syntax: .toJsonString() correctly converts an object to a JSON string without extra spaces (compact mode), which is exactly what’s needed for HMAC
Compact Mode: .toJsonString() automatically removes all indents and spaces that might otherwise occur with normal formatting
The entire process occurs within a single Crypto node; data doesn’t circulate unnecessarily throughout the Workflow

1 Like