A conversation flow diagram maps what a chatbot can say and how a user’s reply changes what happens next. Each block is a system state: it may contain a message or several actions that need no intervening user input. Each arrow represents a possible user intent that moves the conversation to another state. section 12.1.3
Start with the conversation before drawing every branch:
- Define the chatbot’s goal, its users, and what success would look like. section 12.1.2
- Write and, if useful, act out a successful conversation—the happy path. Compare several such conversations to find reusable patterns. section 12.1.2
- Turn those patterns into states and user-intent branches, then choose NLP approaches that can produce responses at each branch. section 12.1.2 section 12.1.3
Onboarding is a manageable first diagram because the chatbot can limit the choices it offers. Lessons and exercises are harder: students may answer in ways the designer did not anticipate. For a tutor used by children, the flow also needs to reflect how they actually access a device and the need for guardian consent and safeguarding responses. section 12.1.3 section 12.1.2
A counting lesson branch
A counting-lesson state asks what follows “11, 12, 13.” Both “14” and “fourteen” lead to its correct-answer state; a default trigger leads to a wrong-answer state. This makes the arrow’s job concrete: it connects an interpreted reply to the bot’s next action. section 12.3.2
Listing 12.1 Elementary counting lesson
- name: start
convo_name: count by one
convo_description: Teach counting to elementary school students
nlp: keyword
version: 3.1
triggers:
- {user_text: "__next__", target: welcome}
- name: welcome
actions:
- send_message: bot_text: Let's start by counting up by 1s.
- send_message: bot_text: I will give you 3 numbers.
- send_message: bot_text: Your answer is the next number in the list.
- send_message:
bot_text: For example, if I say "4, 5, 6" you should answer "7".
- send_message: Now you try
triggers:
- {user_text: "OK", button_text: "OK", target: q1}
- name: q1
actions:
- send_message: bot_text: 11, 12, 13
triggers:
- {user_text: 14, target: correct-answer-q1}
- {user_text: fourteen, target: correct-answer-q1}
- {user_text: "__default__", target: wrong-answer-q1}
- name: wrong-answer-q1
actions:
- send_message: bot_text: Oops!
triggers:
- {user_text: "__next__", target: q1}
- name: correct-answer-q1
actions:
- send_message: bot_text: Exactly right!
triggers:
- {user_text: "__next__", target: q2}
- name: q2
actions:
- send_message: bot_text: 16, 17, 18
triggers:
- {user_text: 19, target: stop}
- {user_text: nineteen, target: stop}
- {user_text: "__default__", target: wrong-answer-q2}
Inspect the lesson specification to see named states, message actions, and triggers—including multiple accepted answers and a default branch—in one artifact. section 12.3.2
Despite the name “dialog tree,” a conversation usually needs a graph: branches can loop back to earlier states. For implementation, a State table can hold nodes and a Trigger table can hold intent-labeled edges. Because the bot generally retrieves only its next state, these one-hop transitions can be stored in a relational database such as PostgreSQL. section 12.3.2 section 12.3.3
Keep the diagram revisable. Log conversations, find paths that end before the goal, and label frequently occurring replies the bot misunderstood. Existing intents may cover some replies; others call for new branches. When hand-writing many similar lessons becomes unwieldy, programmatic content generation or separate language subgraphs can extend the design. section 12.3.3 section 12.6 section 12.3.5
