Capturing multiple user inputs in n8n workflow with WhatsApp API

Hey folks, I’m stuck with my n8n project. Help!

I’m trying to get multiple responses from users through WhatsApp in my n8n workflow. Here’s what I’ve got so far:

  1. User sends a WhatsApp message
  2. Webhook catches it
  3. Code node cleans up the data
  4. Switch node picks a path based on user’s choice
  5. WhatsApp sends more options

The problem is, I can only grab the first message. I’m clueless about how to get the follow-up responses. I’ve tried a few things:

  • Adding another webhook (didn’t work)
  • Checking Meta’s API docs (only found push stuff)
  • Trying to chain webhooks (Meta only lets you use one)

Here’s a bit of the JSON I’m working with:

[
  {
    "messaging_product": "whatsapp",
    "contacts": [
      {
        "input": "",
        "wa_id": ""
      }
    ],
    "messages": [
      {
        "id": "wamid.HBgNNTQ5MTE2NDU1ODczNhUCABEYEjZFRTIzNzc0MDQ0NTVEOTE3NwA="
      }
    ]
  }
]

Any ideas on how to grab that second response? I’m totally stumped!

hey mate, have u considered using the Wait node? it can pause ur workflow til the next message comes in. combine that with a Function node to store user state (like their ID n where they are in the convo) n u might be able to handle multiple responses. jst an idea, lmk if u need more details!

I encountered a similar situation where maintaining context between messages was the main challenge. The solution was to manage the conversation state within the workflow. In my case, I stored the user’s ID and conversation status in a dedicated node right after the initial webhook call. Then I paused the workflow using a node that waits for further input. When the next message arrived, I retrieved the stored state and processed the incoming data accordingly. This approach allowed me to seamlessly handle multiple responses, ensuring that each message was processed in the proper context.