Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create a reusable main menu

Explains how to split the trigger entry and the main menu into two separate scripts, allowing customers to return directly to the main menu from different flows without entering a message again.

When designing a conversation script, a common scenario is that after a customer enters a certain issue flow, they want to use “Back to Main Menu” to see the original menu again.

For example:

  1. The customer enters the “Return Issue” script.

  2. After the query is completed, the screen provides a “Back to Main Menu” button.

  3. After clicking it, the customer expects the system to immediately show the main menu items again, such as “Order Inquiry,” “Return Issue,” and “Contact Support.”

The most common problem in this kind of scenario is usually not “whether the transfer to another script was set up,” but ratherthe linked script is still waiting for an event at the beginning.

For example, the first node of the original main script is “wait for customer message.” Even if you use “go to another script” from the “Return Issue” flow to return to this script, the process will still stop at the event node and will only continue after the customer enters a message again.

Therefore, if the main menu needs to support both “a customer’s first inquiry” and “direct return from other flows,” it is recommended not to place the event entry and the main menu content in the same script, but insteadsplit them into two separate general scripts.

It is recommended to create two different scripts:

  1. Entry script: only responsible for receiving the customer’s first inquiry, keywords, or other events.

  2. Main menu script: another separate script responsible for actually sending the main menu content, with no event at the beginning that requires waiting for customer action.

After the event is triggered, the entry script then connects to the main menu script via “go to another script.”

The structure can be understood as:

Script A: Entry script
└─ Wait for customer message / determine keyword
   └─ Go to another script → “Main menu script”

Script B: Main menu script
├─ Send main menu message
├─ Order inquiry
├─ Return issue
└─ Contact support

Here, the “entry script” and the “main menu script” aretwo different conversation scripts, not two sections within the same script.

Later, when other feature scripts need to “return to the main menu,” they do not need to go back to the entry script; instead, they can directly go to the same “main menu script.”

In this way, whether the customer is making a first inquiry or returning from another flow, they will eventually enter the same main menu script, but only the first inquiry needs to pass through an event node.

Method 1: Directly go to a separate main menu script

If “return to main menu” means the current flow has already ended, the most direct approach is to create aseparate “main menu script”and let other scripts connect to it directly via “go to another script.”

For example, create three scripts in total:

The most important point is:Do not place event nodes such as “wait for customer message” at the beginning of Script B, the “main menu script.”

If the main menu script still begins with an event, even if Script A or Script C successfully goes to Script B, the process will still stop, and the customer will have to enter a message again.

Therefore, it is recommended that the main menu script start directly with nodes that can execute immediately, such as “send message” or “send options.”

Suitable scenarios

  • After completing a certain feature flow, you want to display the full main menu directly.

  • There is no need to return to the original feature script to continue execution.

  • You want multiple feature scripts to share the same main menu.

The “entry script” mainly handles when to start; the “main menu script” handles what to display after starting. After separating them into independent scripts, other feature scripts can skip the entry event and go directly to the main menu script.

Method 2: Split reusable small flows into module scripts

If what needs to be reused is not the entire main menu, but a small shared flow, you can consider using a “module script.”

For example, if multiple scripts all need the same:

  • identity verification

  • order inquiry

  • data confirmation

  • shared prompt messages

you can create a separate module script for different general scripts to call.

Module scripts follow a similar principle: if you want the content to execute immediately after calling the module, the module should not start by waiting for a new customer event.

However,it is not recommended to use a complete main menu with a lot of branching directly as a module. If the main menu needs to go to other feature scripts, transfer to a human agent, or handle the main routing, it is usually better to create a separate general “main menu script.”

Suitable scenarios

  • The same small flow needs to be reused in multiple scripts.

  • After executing the shared flow, you still need to return to the original script and continue the following steps.

  • You want to reduce repetitive setup and future maintenance costs.

Method 3: Trigger the entry script with a button message, then go to the main menu script

If the existing design already relies on customers entering text such as “main menu” or “back to main menu” to trigger the flow, you can keep this approach.

For example:

After the customer clicks it, a new customer message will be sent, which can trigger the original event listening for “Back to Main Menu.”

But it is still recommended to split it into two scripts:

This way, both entry methods can be supported:

The second case does not need to go through the entry script again, because the customer is already in the flow and does not need to create another message event to display the main menu.

Suitable scenarios

  • The existing system already uses keyword triggers extensively.

  • You still want customers to be able to type text such as “main menu” to open the menu themselves.

  • At the same time, you also want other feature scripts to be able to return directly to the same main menu.

If “waiting for customer events” and “displaying the main menu” are placed in the same script, then every time this script is revisited by another flow, it may stop again at the event node.

After splitting into two scripts, the responsibilities will be clearer:

Script
Main purpose
Can there be an event at the beginning?

Entry script

Receive first inquiry, keyword, or specified customer message

Yes

Main menu script

Actually send the main menu, shared by the entry and other feature scripts

Not recommended

The complete relationship is as follows:

Therefore, the “main menu script” can be viewed as the destination that all flows go to together; the “entry script” is just one of the sources that leads to it.

Which method should be chosen?

Requirement
Recommended method

After other feature flows end, directly return to the full main menu

Create an independent Main menu script, and go directly via “go to another script”

Multiple scripts only need to share a small part of the process

Use module script

Keep the “main menu” keyword or button message trigger

Let Entry script receive the event, then go to the independent Main menu script

If the existing architecture already relies on keyword triggers, there is no need to redo everything. You can keep the script that originally handles event reception, move the part that actually displays the menu into a new “main menu script,” and then have both the original entry script and other feature scripts go to this new script.

Design recommendations

As scripts become more complex, you can separate different responsibilities for management:

  • Entry script (general script): a separate script responsible for the customer’s first inquiry, keyword, or other event triggers, and uses “go to another script” after the conditions are met.

  • Main menu script (general script): another separate script that actually sends the main menu and handles the main service routing; it no longer waits for a new customer event at the beginning.

  • Feature script (general script): for example, return, order, membership, and other complete service flows; when a return is needed, directly go to the “main menu script.”

  • module script: place small operations that are reused by multiple flows.

In this way, “how to trigger” and “what to execute after triggering” are handled by different scripts. When new services are added or the main menu is adjusted later, all entry and feature flows can also share the same main menu script.

Last updated