Challenge Response in Webhook


I’m trying to make a web hook to receive stripe events, however they want to do a challenge response before I can add the web hook URI. How would I return a json key provided in the POST body in the body of the response?

“body”: {
“type”: “url_verification”,
“token”: “Nc0V120SQ9fdeN8zF8MXBdSD”,
“challenge”: “1zp6ZmZ5eTOeJthMWRe9YTRl2EPMREvlv3OZrcjKwg8TVaTnNp7z”

They expect 1zp6ZmZ5eTOeJthMWRe9YTRl2EPMREvlv3OZrcjKwg8TVaTnNp7z back


Sorry for the late answer! It took me a while to come up with a way to do it currently without changing the code. It can be done with returning binary data.

Here a simple example workflow which receives the challenge via “GET” (to test easily) and the query parameter “challenge” returns it:

So if test and you call the workflow like this:

It should then return “test123” (without quotes)

Hey Jan, I wanted to thank you for writing that, definitely went above and beyond there.

I got it to work with Slack (I know I wrote stripe, mistyped there) by changing, it to post and then changing the javascript function “items[0].json.query.challenge” to “items[0].json.body.challenge”. After that they registered my callback URI perfectly.

Sorry to bring this back, trying to do exatly same thing here but getting this error:

TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type undefined
    at Function.from (buffer.js:293:9)
    at new Buffer (buffer.js:253:17)
    at Object.base.construct (/usr/local/lib/node_modules/n8n/node_modules/vm2/lib/contextify.js:539:31)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes:3:13
    at Object.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes:9:2)
    at (/usr/local/lib/node_modules/n8n/node_modules/vm2/lib/main.js:520:23)
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Function.node.js:64:31)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/src/Workflow.js:554:37)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:370:62
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:432:15

any advice is really appreciated !