Skip to main content
Branching lets you ask additional questions only when a specific earlier answer warrants them. You declare branches in the top-level branches array and tag each conditional question with the branch’s ID.

How branching works

Setting up a branch is a two-step process:
1

Declare the branch

Add a branch object to the top-level branches array. Give it a unique id and a condition that references an earlier question by its name.
2

Tag the conditional questions

On each question that should only be asked when the branch condition is true, add "branch_id": "<your-branch-id>". You can tag as many questions as you like with the same branch_id.
When the call reaches a branched question, FormBharo evaluates the condition first. If the condition is true, the question is asked normally. If it is false, the question is skipped entirely.

Branch object fields

string
required
A unique identifier for this branch. Referenced by questions using branch_id. Use a short, descriptive slug — e.g., "fever-details".
object
required
The trigger condition. Evaluated when the call reaches any question tagged with this branch’s ID.
If you include both equals and present in the same condition, present takes precedence and equals is silently ignored.

Completion

Branch questions that were never activated do not block the complete status. If a call reaches the end of the question list without ever triggering a branch condition, the conversation is still marked complete — the skipped branch questions are treated as if they were not part of the required flow for that caller.

Save validation errors

If the agent save is rejected due to a branching configuration problem, the 400 response includes a validation_issues array. Each issue has a field and a message. The following configuration errors are caught at save time:
  • Unknown branch_id on a question — the branch_id value does not match any branch declared in branches.
  • condition.field references a non-existent question — no question with that name exists in the questions array.
  • Controlling question appears after the branch’s questions — the question named in condition.field must precede all questions tagged with this branch.
  • equals condition on a non-boolean questionequals is only valid when the controlling question has response_type: "boolean".
  • Duplicate branch IDs — two or more branches share the same id.
  • Branch missing required fields — a branch object is missing id, condition, or condition.field.

Example

This agent asks whether the caller has a fever. If they answer yes, it branches into two follow-up questions about their temperature and how long the fever has lasted.
In this example, temperature and fever_duration_days are only asked if the caller answers yes to has_fever. The final question (on_medication) is asked for all callers.