Define the Routing Model

Updated 

The Routing Model defines how users can navigate between screens within a WhatsApp Flow. It controls the allowed transitions between screens and determines the overall flow structure.

By configuring a routing model, developers can restrict users to only the intended navigation paths. For example, a user on FIRST_SCREEN may be allowed to navigate only to SECOND_SCREEN or THIRD_SCREEN, while access to other screens is restricted unless explicitly defined.

Sample Routing Model

"routing_model": {  "FIRST_SCREEN": [    "SECOND_SCREEN",    "THIRD_SCREEN"  ],  "SECOND_SCREEN": [    "THIRD_SCREEN"  ],  "THIRD_SCREEN": [    "TERMINAL_SCREEN_1"  ],  "FOURTH_SCREEN": [    "TERMINAL_SCREEN_2"  ],  "TERMINAL_SCREEN_1": [],  "TERMINAL_SCREEN_2": []}

Understanding the Example

In the example above:

  • Users on FIRST_SCREEN can navigate to either SECOND_SCREEN or THIRD_SCREEN.

  • Users on SECOND_SCREEN can navigate only to THIRD_SCREEN.

  • Users on THIRD_SCREEN can navigate to TERMINAL_SCREEN_1.

  • Users on FOURTH_SCREEN can navigate to TERMINAL_SCREEN_2.

  • TERMINAL_SCREEN_1 and TERMINAL_SCREEN_2 have no outgoing routes, making them terminal screens.

  • Entry Screen: Every flow must have an entry screen. An entry screen is a screen that has no inbound routes from any other screen and serves as the starting point of the flow. In the example above:

  • FIRST_SCREEN is the entry screen because no other screen routes to it.

  • Terminal Screens: A terminal screen is a screen from which no further navigation is possible. Terminal screens are identified by an empty route array ([]) in the routing model. In the example above, the given options are terminal screens.

    • TERMINAL_SCREEN_1

    • TERMINAL_SCREEN_2

  • A flow can contain one or multiple terminal screens depending on the use case.

Steps to Configure a Routing Model

1. Configure Data Endpoint. Click Set up endpoint.

2. On the Set up endpoint window, define the Routing Model by configuring the screen transitions.

3. Click Select screens fields to set the transitioning screen from the ones configured in the JSON Flow.

4. Click Continue to save the routing model.

Note: After you save the flow, the configured Routing Model is automatically appended to the Flow JSON.

Routing Rules

When defining a routing model, the following rules must be followed:

Do Not Route to the Same Screen

  • A screen cannot route to itself.

  • Invalid Example: FIRST_SCREEN → FIRST_SCREEN

  • Self-referencing routes are not supported.

Define Only Forward Routes

  • Only forward navigation paths should be configured.

  • For example, if you define: SCREEN_A → SCREEN_B, you should not define: SCREEN_B → SCREEN_A. This helps prevent routing loops and circular navigation paths.

Back Navigation is Automatically Supported

If a route exists between two screens, users can move between those screens using the WhatsApp Flow Back button. Because of this behavior, reverse routes do not need to be explicitly defined.

Screens Can Have No Forward Routes

  • If a screen represents the end of a journey, its route list can be empty.

  • Example: "TERMINAL_SCREEN_1": []

  • This indicates that no further navigation is available from that screen.

Every Flow Must Have an Entry Screen

  • At least one screen in the routing model must have no inbound routes and act as the starting screen for the flow.

All Navigation Paths Must End at a Terminal Screen

  • Every valid route in the flow should eventually lead to a terminal screen.

  • This ensures that users can successfully complete the flow without encountering dead ends or infinite navigation loops.

Best Practices

  • Define a clear entry screen before building the flow.

  • Keep navigation paths simple and easy to follow.

  • Avoid circular routes between screens.

  • Ensure every possible user journey ends at a terminal screen.

  • Use meaningful screen names to improve maintainability and troubleshooting.

  • Validate the routing model whenever new screens are added to the flow.