Loop
This topic provides an overview of the Loop component, and describes its configuration as well as supported connections.
Component introduction
- Run a loop until a fixed count is reached.
- Run a loop while the configured condition is true.
Component configuration
- After adding Loop component to a message flow, click
Loop component to proceed with the
configuration.

- In the pop-up right panel, configure the loop strategy as needed.
Loop Method Instruction Loop until the fixed count is reached To run the loop until a fixed count is reached, complete the following settings.

- In the Loop Method drop-down list, select Loop until the fixed count is reached.
- In the Count field,
specify how many times the loop should
repeat.Note: You can enter a value between 1 and 99.
- At the bottom-right corner, click
Confirm.
The configured strategy appears on the component.

Loop while condition is true To run the loop while the condition is true, complete the following settings.

- In the Loop Method drop-down list, select Loop while condition is true.
- In
the Expression field,
enter
an expression that returns a
Booleanvalue. The loop runs when the result istrueand is skipped whenfalse.For example, enter FX_EQUAL($Session.contactNumber,"199xxxx8888") as the loop condition, the session will enter the loop when the customer's number is 199xxxx8888.
Note:An expression may include variables, constants, and functions. You can enter
FXto view and select system‑supported functions, and enter$to view and select variables already stored in the current message flow.For more information about functions and variables, see Variables and Functions in Yeastar Expression.
- At the bottom-right corner, click
Confirm.
The configured strategy appears on the component.

- Click
inside the loop to add the components that you want to repeat.Note: If you add a nested Loop component, up to 3 levels of nesting are supported.
-
Optional: To route the message session or trigger other actions when the loop ends, click
on the loop component border to
add the next component.For more information about components that support to be connected, see Component connections.
Component connections
End components Transfer and Close are unavailable for this insertion method.

| Component | Description |
|---|---|
| Send Message | Send Message component enables the
system to automatically send messages to customers. For more information, see Send Message. |
| Send WhatsApp Template Message | Send WhatsApp Template Message
component enables the system to automatically send messages to
customers using specified WhatsApp message templates. Important: This component is
available only when the message flow is only applicable to
WhatsApp channel type.
For more information, see Send WhatsApp Template Message. |
| Wait for Reply | Wait for Reply component allows you to
set the reply timeout and route the message session depending on
whether a reply is received. For more information, see Wait for Reply. |
| Menu | Menu component allows you to present
the customer with a set of menu options, and route the message
session based on the value that they reply. For more information, see Menu. |
| Business Hours |
Business Hours component allows you to route the message session to different destinations based on the time of day. For more information, see Business Hours. |
| Wait | Wait component enables the system to automatically
route the message session to the connected component upon reply
timeout. For more information, see Wait. |
| Condition | Condition component allows routing the message session
based on logical expressions. For more information, see Condition. |
| Loop | Loop component allows a group of
components to be executed repeatedly based on the loop
strategy. For more information, see Loop. |
| Internal Data Ops | Internal Data Ops component allows you
to query data from PBX-native database. For more information,
see the following topics: |
| Email Sender | Email Sender component enables the
system to automatically send emails to a recipient via
configured email server and record the send logs, enabling
real-time notifications. For more information, see Email Sender. |
| Database Access | Database Access component allows you
to interact with database during a message flow. You can execute
SQL operations to retrieve or update data as needed. For more information, see Database Access. |
| HTTP Request | HTTP Request component allows you to
send HTTP requests to external web servers, enabling data
exchange with third-party services. For more information, see HTTP Request. |
| Transfer |
Transfer component allows you to transfer the message session to a specific destination to terminate the current message flow. For more information, see Transfer. |
| Close | Close component enables the system to
automatically disconnect the message session to terminate the
current message flow. For more information, see Close. |
