Chapters

Chapter 4

Designing flows

The flow designer is where you build the conversation: a canvas of steps joined by connections.

The designer at a glance

The flow designer for a sample bot.
Figure 5. The flow designer for a sample bot.
AreaWhat it does
Top barShows the bot name, the save status (Saved), and the published version. Validate checks the draft, Test opens the playground, and Publish releases the draft.
Flow toolbarUndo and redo, Auto layout to arrange the steps, Intents, Variables, Fullscreen, and more flow options.
CanvasScroll to zoom and drag to pan. The zoom controls at the top left include Fit all steps in view.
Left edgeOpens the Flows panel.
Right edgeOpens the Spire Bot Assistant, the Components panel, and the Outline panel.
Status barShows the number of steps and connections in the flow.
Important

Publish acts immediately. There is no confirmation step: the saved draft becomes the live version as soon as you select it. Validate and test first.

Flows

A bot is made of several flows, each handling one goal. Open the Flows panel to search flows, switch between them, or create a new one. The flow marked START is where every conversation begins.

The Flows panel lists every flow in the bot.
Figure 6. The Flows panel lists every flow in the bot.

Add and connect steps

  1. Open the Components panel from the right edge of the canvas.
  2. Find the step you need. Use the search box if the list is long.
  3. Drag the step onto the canvas.
  4. Drag from the connector on one step to another step to connect them.
  5. Select the step and complete its properties.
The Components panel.
Figure 7. The Components panel.
GroupStepsUse them to
ConversationText response, User input, Menu / choice, Buttons, Carousel, PauseSend messages and collect answers.
WhatsAppMedia, Location, Contact card, Message template, WhatsApp Flow, Product, Catalog, ReactionUse formats specific to WhatsApp.
LogicCondition, AI Router, Set Variable, JumpBranch on rules, classify natural language, store values, and reuse another flow.
ActionsAPI Call, Knowledge, Run Script, Live AgentCall external systems, answer from your documents, transform data, and hand over to a person.

Edit a step

Select a step to open Step properties. Give the step a name that describes its outcome, then fill in its content. Insert variable adds a placeholder such as {{customer_id}} at the cursor. Flow connections shows where the step leads next. Duplicate step and Delete step are at the bottom of the panel.

Step properties for a Text response step.
Figure 8. Step properties for a Text response step.

The Outline panel lists the steps of the current flow in order, which is a quick way to move around a large flow.

Variables

Variables carry values between steps. Declare each one before a step uses it.

  1. Select Variables in the flow toolbar.
  2. Select New Variable.
  3. Enter a unique name, choose a type such as Text, Number, or JSON, and choose a scope.
  4. Select Done.

Use conversation scope for values that must last for the whole session, and turn scope for short-lived values. Use readable names such as customer_id, order_total, and needs_handoff.

Conversation variables.
Figure 9. Conversation variables.

Intents

An intent lets a customer reach a flow by typing what they want instead of choosing a menu option.

  1. Open the flow and select Intents in the flow toolbar.
  2. Select Add intent.
  3. Enter a short name, and describe what belongs in the intent and what does not.
  4. Add at least two example messages with different wording, one per line. You can add up to twenty.
  5. Under Details to collect, add anything the flow needs, such as an order number. The bot takes it from the message or asks for it.
  6. Select Done.
An intent with its description and example messages.
Figure 10. An intent with its description and example messages.

Spire Bot Assistant

The assistant drafts changes for you. Open it from the right edge of the canvas and describe what you want: a new flow, a change to a step, or an API to add. You can also paste a cURL command.

The Spire Bot Assistant beside the canvas.
Figure 11. The Spire Bot Assistant beside the canvas.

Design guidelines

DoAvoid
Name flows and steps by outcome.Hiding business rules in message text.
Ask one question at a time.Loops without a retry limit.
Confirm important writes or transactions.Assuming an API always succeeds.
Give every branch an Else or fallback path.Collecting data that is not required.
End with a result and the next available action.Leaving steps disconnected from the entry.