Webhook not parsing Z-API data correctly to Google Sheets

Hi everyone, I’m facing an issue that seems simple but I haven’t been able to solve it.

I have two connected workflows:

  1. Workflow 1: Sends a WhatsApp message with buttons (using Z-API) to confirm an appointment.
  2. Workflow 2: Receives the patient’s response via Webhook (POST) and tries to write the response data into a Google Sheets spreadsheet.

The Webhook receives the data correctly — including senderName, phone, momment, and the message (either from buttonsResponseMessage.message or message). I confirmed that all of this is present in the body of the Webhook.

Then I use an Edit Fields node to map these:

  • Name: {{$json["body"]["senderName"]}}
  • WhatsApp: {{$json["body"]["phone"]}}
  • Message Date: {{ new Date(Number($json["body"]["momment"])).toLocaleString("pt-BR") }}
  • Patient Message: {{$json["body"]["buttonsResponseMessage"]["message"] || $json["body"]["message"] || "No message"}}

The problem is:
In the Google Sheet, the values are showing as undefined or Invalid Date, as if the fields are not being accessed correctly. The webhook input data is correct — I can see all values — but the Edit Fields and Google Sheets node don’t seem to write them properly.

I’ve tried:

  • Validating the exact JSON structure from the Webhook;
  • Toggling Include Other Input Fields in the Edit Fields node;
  • Changing the field mapping and using fallback values.

Screenshots of the full flow are attached.


Late, but for anyone who lands here with the same problem: the rows with undefined are most likely not the patient’s reply. If that webhook URL also gets status updates or other notifications from Z-API, each one starts its own execution with no senderName and no buttonsResponseMessage, and momment can be missing too, which is where Invalid Date comes from.

Two changes should sort it. Put an If node right after the Webhook and only continue when {{ $json.body.type }} is ReceivedCallback and {{ $json.body.fromMe }} is false. Then fix the text path: a plain text reply arrives in body.text.message, not body.message, so the fallback becomes

{{ $json.body.buttonsResponseMessage?.message || $json.body.text?.message || “No message” }}

momment is already in milliseconds, so new Date($json.body.momment) is enough.

Disclosure, since it’s our payload: I’m the Z-API account. The field names are from the callback examples in the Z-API docs.