When working with WhatsApp Flows, you might run into the following error:
INVALID_ROUTING_MODEL
Following screens are missing in the routing model: (screenIDs).
This is a structural issue with your flow JSON. Let's break it down.
What Triggers INVALID_ROUTING_MODEL
This error occurs when one or more screen.ids defined in the screens array are not referenced anywhere in the routing_model. The WhatsApp API expects that every screen must be part of the routing logic — if a screen is unreachable, it’s considered invalid.
WhatsApp Flow JSON Structure Overview
A flow JSON has two key sections:
1. screens
An array of all screens used in the flow — each must have a unique id.
"screens": [
{
"id": "FIRST_SCREEN",
"type": "FORM",
...
}
]
2. routing_model
A mapping of screen transitions. It defines:
The start screen
Where each screen routes next, based on conditions or button selections
"routing_model": {
"FIRST_SCREEN": [
{
"conditions": [...],
"target": "NEXT_SCREEN"
}
],
"NEXT_SCREEN": []
}
Invalid Example
{
"routing_model": {
"ABC": []
},
"screens": [
{
"id": "FIRST_SCREEN",
"type": "FORM"
}
]
}
FIRST_SCREEN is defined in screens.
But routing_model only includes ABC.
- Result: FIRST_SCREEN is considered unreachable → error thrown.
{
"routing_model": {
"FIRST_SCREEN": []
},
"screens": [
{
"id": "FIRST_SCREEN",
"type": "FORM"
}
]
}
- Now FIRST_SCREEN is part of the routing model.
- WhatsApp knows the flow starts or passes through this screen → error resolved.
Fixing the Error: Step-by-Step
1. Identify Missing Screens
Read the error:
INVALID_ROUTING_MODEL: Following screens are missing in the routing model: FIRST_SCREEN, END_SCREEN
2. Check for Typos
Ensure the screen ids in routing_model match exactly with the ones in screens.
3. Add Missing Screens to Routing
Include them in the routing_model like so:
"routing_model": {
"FIRST_SCREEN": [
{
"target": "END_SCREEN"
}
],
"END_SCREEN": []
}
4. Optional: Remove Unused Screens
If any screen isn't meant to be used, remove it from the screens array to avoid unnecessary validation errors.
For more troubleshooting insights related to WhatsApp Business API, check out heltar.com/blogs.