whatsapp-flows

Why is my WhatsApp Flow endpoint returning an error when showing a terminal screen after data exchange?


I'm building a WhatsApp Flow experience where the user selects a service type (e.g., get a daily update, ask a question, etc.). After the user selects one of the options (e.g., "daily update") and clicks Continue, my backend generates a message and sends it to the chat. Then, I try to return a new screen with a confirmation message and a close button.

However, I receive this error in WhatsApp Manager:

"Endpoint did not return a successful response" "Failed to fetch response from endpoint"

Here is the JSON I return from my backend after processing the request:

{
  "version": "3.0",
  "screen": "FORECAST_DONE",
  "data": {
    "forecast_done_title": "Forecast Sent",
    "forecast_done_note": "Your daily forecast is ready. Please check the chat for details.",
    "footer_close": "Close"
  }
}

And here is the structure of the FORECAST_DONE screen (declared in my flow JSON):

{
  "id": "FORECAST_DONE",
  "title": "${data.forecast_done_title}",
  "terminal": true,
  "data": {
    "forecast_done_title": {
      "type": "string",
      "__example__": "Sent"
    },
    "forecast_done_note": {
      "type": "string",
      "__example__": "Please check the chat for details."
    },
    "footer_close": {
      "type": "string",
      "__example__": "Close"
    }
  },
  "layout": {
    "type": "SingleColumnLayout",
    "children": [
      {
        "type": "TextBody",
        "text": "${data.forecast_done_note}"
      },
      {
        "type": "Footer",
        "label": "${data.footer_close}",
        "on-click-action": {
          "name": "complete",
          "payload": {}
        }
      }
    ]
  }
}

From what I understand, this should close the flow. But instead, it seems to result in an endpoint error after submission.

Question: What might be causing WhatsApp to reject this response? Is there anything wrong with returning a terminal screen after processing data?

Any advice is appreciated. Thanks!


Solution

  • WhatsApp Flows expects a response from the endpoint within 3 seconds, and if that doesn't happen - an error "Failed to fetch response from endpoint" appears, even if you then return the correct JSON.