Accessing Webhook Response Body in Node Js

Hello, I’m having some trouble accessing the webhook response body from a node js server. The response printed to the console is the following:

<ref *1> Gunzip {
  _writeState: Uint32Array(2) [ 0, 0 ],
  _readableState: ReadableState {
    objectMode: false,
    highWaterMark: 16384,
    buffer: BufferList { head: null, tail: null, length: 0 },
    length: 0,
    pipes: [],
    flowing: null,
    ended: false,
    endEmitted: false,
    reading: false,
    constructed: true,
    sync: false,
    needReadable: false,
    emittedReadable: false,
    readableListening: false,
    resumeScheduled: false,
    errorEmitted: false,
    emitClose: true,
    autoDestroy: true,
    destroyed: false,
    errored: null,
    closed: false,
    closeEmitted: false,
    defaultEncoding: 'utf8',
    awaitDrainWriters: null,
    multiAwaitDrain: false,
    readingMore: false,
    dataEmitted: false,
    decoder: null,
    encoding: null,
    [Symbol(kPaused)]: null
  _events: [Object: null prototype] {
    prefinish: [Function: prefinish],
    unpipe: [Function: onunpipe],
    error: [ [Function: onerror], [Function (anonymous)] ],
    close: [Function: bound onceWrapper] { listener: [Function: onclose] },
    finish: [Function: bound onceWrapper] { listener: [Function: onfinish] }
  _eventsCount: 5,
  _maxListeners: undefined,
  _writableState: WritableState {
    objectMode: false,
    highWaterMark: 16384,
    finalCalled: false,
    needDrain: false,
    ending: false,
    ended: false,
    finished: false,
    destroyed: false,
    decodeStrings: true,
    defaultEncoding: 'utf8',
    length: 47,
    writing: true,
    corked: 0,
    sync: false,
    bufferProcessing: false,
    onwrite: [Function: bound onwrite],
    writecb: [Function: nop],
    writelen: 47,
    afterWriteTickInfo: null,
    buffered: [],
    bufferedIndex: 0,
    allBuffers: true,
    allNoop: true,
    pendingcb: 1,
    constructed: true,
    prefinished: false,
    errorEmitted: false,
    emitClose: true,
    autoDestroy: true,
    errored: null,
    closed: false,
    closeEmitted: false,
    [Symbol(kOnFinished)]: []
  allowHalfOpen: true,
  bytesWritten: 0,
  _handle: Zlib {
    onerror: [Function: zlibOnError],
    buffer: <Buffer 1f 8b 08 00 00 00 00 00 00 03 ab 56 ca 4d 2d 2e 4e 4c 4f 55 b2 52 50 f2 48 cd c9 c9 57 08 c9 c8 cf 4d 2c 56 aa 05 00 c3 e6 10 40 1b 00 00 00>,
    cb: [Function (anonymous)],
    availOutBefore: 16384,
    availInBefore: 47,
    inOff: 0,
    flushFlag: 2,
    [Symbol(owner_symbol)]: [Circular *1]
  _outBuffer: <Buffer 7b 22 6d 65 73 73 61 67 65 22 3a 20 22 48 65 6c 6c 6f 20 54 68 6f 6d 61 73 22 7d 00 30 00 00 00 28 06 64 8a 22 02 00 00 48 06 64 8a 22 02 00 00 28 20 ... 16334 more bytes>,
  _outOffset: 0,
  _chunkSize: 16384,
  _defaultFlushFlag: 2,
  _finishFlushFlag: 2,
  _defaultFullFlushFlag: 3,
  _info: undefined,
  _maxOutputLength: 4294967296,
  _level: -1,
  _strategy: 0,
  [Symbol(kCapture)]: false,
  [Symbol(kCallback)]: null,
  [Symbol(kError)]: null

Any ideas on how to access the body content? Thanks

Hi @thomstove,

Please correct me If I am mistaken about your requirements. So, As per your description, you are triggering Make Webhooks via Node.js, right?

And, You are using Webhook Response in Make Scenario to send custom data back to your system with the predefined body, right?

If you are not using the Webhook Response module then it will return only Accepted as part of the response without any formatting with Content-Type as text/plain; charset=utf-8.

Can you share me your scenario, So I can review what can be done with it.

1 Like

Hi Runcorn,

He didn`t answer, but I am having the same problem (Almost).
Yes, I am triggering a Make Webhook via a Fetch using js.
And using a “Webhook response” module to get a custom data back with a predefined body.

In both ways, using the webhook response or not, the response.body comes as Readablestream.

ReadableStream {locked: true}
ƒ cancel()
ƒ getReader()
ƒ pipeThrough()
ƒ pipeTo()
ƒ tee()
ƒ ReadableStream()
get locked
ƒ locked()

I`ve managed to access the response.body using:

        const responseBody = await handleWebhookJson(webhookUrl, jsonBodyData)
        const reader = responseBody.getReader();
        const data = await;
        const decoder = new TextDecoder();
        const decodedData = decoder.decode(data.value);
        console.log(decodedData); //With webhook response: {"message":"success"}
        //Without webhook response: accepted

But I didnt want it that way, I need to use other automations, like zapier and others, and I need the data to come in the same format for all.


Here is the function that makes the request…

 async function handleWebhookJson(url: string, jsonBody: string) {
            const config = {
                method: 'POST',
                headers: {
                    'Accept': 'application/json',
                    'Content-Type': 'application/json'
                body: jsonBody

                const response = await fetch(url, config)
                return response.body

Hi @AlexandreDaltro ,

When I execute your code and change response.body to await response.json() then I get back the JSON result.

Does this resolves your issue?

Glenn - Callinetic

1 Like


That worked perfectly well! You saved me!
Thanks a lot!

I seems I need to learn much more about js requisitions.