Skip to the content

Structured procedures

Fixed steps that run in the same order every time: the questions, the checks, the tools and the exact wording. Use them for identity checks, payments and any script that must not change.

Where
Assistant menuConfigureProceduresAddNew structured procedure
Permission
Needs Change assistant setup
Time
12 min read
Markdown
01 / 05Steps that always run in order. A structured procedure is a list of steps. It never skips or reorders them.
  1. Steps that always run in order. A structured procedure is a list of steps. It never skips or reorders them.
  2. Pick a step type. Add step offers eleven types: Ask, Tell, Say, If, Tool, Sub-procedure, Hand off, End conversation, Retry, End procedure and Show.
  3. Ask for one detail. Name the variable, choose the answer type, and say what to ask. The assistant words the question in the customer's language.
  4. Branch with If. Check a saved value, or ask the assistant a yes-or-no question about the conversation.
  5. Publish. With no errors left, publish. Version 1 runs from the next message.

What a structured procedure is

A structured procedure is a procedure made of steps instead of written instructions. HeyServo runs the steps one by one, in order, not by the assistant's judgement. The assistant only words the questions and messages you leave to it, and answers if the customer asks something in between.

Everything else works as for free-form procedures: the trigger, the key, folders, drafts, Publish, Versions, Test, the on/off switch and the Details panel. That page covers them.

01 / 03The procedure starts. The request matches the trigger. The first step is an Ask, so the run waits for the answer.
  1. The procedure starts. The request matches the trigger. The first step is an Ask, so the run waits for the answer.
  2. Answer, tool, choice. The answer is saved, the tool runs straight away, and the next Ask shows its choices as buttons.
  3. Exact words to finish. The Say step sends your wording as written, then the procedure ends.

Sara moves her appointment at Marina Clinic. The trace shows each step as it runs.

Structured or free-form?

Choose structured when
  • Every question must be asked, in a set order
  • You need exact wording, word for word, in each language
  • A step must check an answer before going on (a date, an email, a phone number)
  • The task is an identity check, a payment or a regulated script
Choose free-form when
  • The task needs judgement and a natural conversation
  • The order of questions can follow the customer
  • You want to describe the task in a few paragraphs
  • You are not sure yet: free-form is quicker to write

Build a structured procedure

GoalA published structured procedure.

  1. 1

    Click AddNew structured procedure

    Name it (for example Verify identity), pick a folder if you like, and click Create.

  2. 2

    Write the Trigger

    When the assistant should start it, from the customer's side. Leave it empty for a sub-procedure.

  3. 3

    Click Add step and choose a type

    Add the steps in the order they should run. Each step opens its own form.

  4. 4

    Save the answers you need later

    Give Ask and Tool steps a variable name, then use it in later steps as {{name}}.

  5. 5

    Fix what the editor flags

    A step with errors shows Needs a fix. The list above the steps counts Errors to fix before publishing.

  6. 6

    Click Test, then Publish

How a structured run behaves

  • Only Ask waits for the customer. Every other step runs straight away, in the same turn.
  • Say text goes out exactly as written, with no model involved. Tell and Ask questions without exact wording are phrased by the assistant, in its own style and the customer's language.
  • When the procedure starts, answers the customer has already given are filled in, and those Ask steps are skipped. The trace shows Step: … (already known, not asked).
  • Choices are shown as tappable buttons where the channel can draw them.
  • Tool steps call the tool as the assistant would, and their results are visible to later steps and turns.
  • Only one structured procedure runs at a time in a conversation. Starting another interrupts the first.

What happens to a reply at an Ask

The customer's reply isWhat happensIn the trace
An answerIt is checked and saved, and the run moves on. If the same message also answers later Ask steps, those answers are saved too.Got the answer
A question or something elseThe assistant answers briefly, then asks again. The run keeps waiting. If the customer clearly wants something else, the procedure ends.The customer asked something else
A wish to stopThe run ends as cancelled.The customer called it off
An answer that does not fitThe question is asked again, up to Ask at most, then If there is still no answer applies.The answer did not fit: asking again

Language

When the customer writes in Arabic script, the Arabic versions of your exact texts are used; when they switch back to Latin script, the run switches back. Very short messages keep the current language.

The step types

StepWhat it does
AskAsk the customer for something and wait for the answer.
TellTell the customer something, phrased by the assistant.
SaySend exact words, with a version per language.
IfBranch on an answer or on a question for the assistant.
ToolCall a tool and keep its result.
Sub-procedureRun another procedure here.
Hand offHand the conversation to a person.
End conversationSay goodbye and close the conversation.
RetryGo back to an earlier step, a few times at most.
End procedureFinish the procedure here.
ShowShow a tool's result as cards where the channel can.

Ask

Ask9 controls
Save the answer asText
The variable name later steps use as {{name}}. Lowercase letters, digits and _, starting with a letter. It cannot be a built-in variable name such as customer_name.
Limit 40 characters
Answer typeChoice
How the answer is checked (see the table below).
Default TextOptions TextNumberYes or noChoiceDateTimeEmailPhone numberName
What to askText
What you need, for example Ask for the check-in date. The assistant phrases it for the customer, in their language.
Exact question (optional)Text
Sent word for word instead of the assistant's phrasing. Either this or What to ask is required.
Exact question in other languagesList
A Language code and Text in … per language. When the customer writes in one of these languages, its version is asked instead. Needs an exact question.
Limit 20 languages
ChoicesList
For the Choice type: Add choice, Remove choice. Shown as buttons where the channel can draw them.
Limit 2 to 10 choices, each up to 60 characters, no repeats
Ask at mostNumber
How many times the question is asked before giving up.
Default 2Limit 1 to 5
If there is still no answerChoice
What happens after the last try. If human handoff is off for the assistant, Hand off to a person ends the procedure instead.
Default Hand off to a personOptions Hand off to a personEnd the procedureCarry on without it
Always ask, even if they already said itSwitch
Not ticked: an answer the customer already gave is used and the step is skipped, except yes-or-no questions, which are always asked. Ticked: always asks.
Answer typeWhat is accepted
Text, NameAny text, trimmed, up to 500 characters
NumberA number. Arabic-Indic digits are accepted and thousands commas are removed.
Yes or noYes and no words in English and Arabic, such as yes, ok, sure, نعم, تمام, no, nope, لا
ChoiceThe choice tapped or typed, its number (1, 2, …), or the only choice the message mentions
DateA date, saved as YYYY-MM-DD
TimeA time, saved as HH:MM on the 24-hour clock
EmailA valid email address
Phone numberDigits with an optional +, at least 7

Tell

Tell1 controls
What to tell the customerText
Required. For example Let them know a deposit is needed to hold the room. The assistant phrases it naturally, in the customer's language.

Say

Say2 controls
Exact textText
Sent as written. Use {{variable}} to fill in an answer, for example Thanks! Your booking is confirmed.
Other languagesList
A version per language code (en, ar, en-GB). When the customer writes in one of these languages, its version is sent instead.
Limit 20 languages

If

If7 controls
Check a value / Ask the assistantChoice
Branch on a saved value, or on a yes-or-no question about the conversation.
VariableText
Check a value: the variable to test. A path works too, such as booking.status.
ConditionChoice
How to compare.
Options isis notcontainsis more thanis at leastis less thanis at mostis knownis unknown
ValueText
What to compare with. Not used with is known and is unknown.
Question for the assistantText
Ask the assistant: a yes-or-no question answered from the conversation so far, such as Did the customer say it is urgent?
ThenList
Steps that run when the condition holds, with their own Add step.
OtherwiseList
Steps that run when it does not. Empty: carry on with the next step.

Comparisons are made as numbers when both sides are numbers, then as dates or times, otherwise as text without regard to case. contains on a list checks whether the list holds the value. Conditions nest at most 4 deep.

Tool

Tool6 controls
ToolChoice
A connected tool or a built-in one. Tools switched off for the assistant are marked switched off; missing ones show (not found).
Instruction (optional)Text
Helps the assistant fill in the inputs it decides, for example Use the dates the customer gave.
InputsList
Type an Input name and pick where its value comes from. Inputs you leave out are filled in by the assistant.
Options Fixed valueFrom a variableAssistant decides
Save the result as (optional)Text
A variable for later steps. Results are kept as data where possible, so {{rooms.0.name}} works.
If the tool failsChoice
What happens when the tool returns an error.
Default Say a message and carry onOptions Say a message and carry onHand off to a personEnd the procedureCarry on
Message (optional)Text
With Say a message: what to say, for example Sorry, I couldn't check that right now. Empty: the assistant apologises in its own words.

Sub-procedure

Sub-procedure1 controls
Procedure to runChoice
Another procedure of this assistant. A structured one runs here step by step; a free-form one takes over.

Hand off

Hand off1 controls
Reason (optional)Text
What your team sees with the conversation, such as Wants a refund over the limit. The customer hears the assistant's usual handover message. If human handoff is off, this step is skipped.

End conversation

End conversation1 controls
Goodbye message (optional)Text
Sent before the conversation closes. Empty: the assistant says goodbye in its own words.

Retry

Retry2 controls
Go back toChoice
An earlier step, usually the question to ask again. It must come before the Retry.
At mostNumber
How many times to go back. After that the run carries on with the next step.
Default 2Limit 1 to 5

End procedure

End procedure1 controls
Ends asChoice
Counted in the procedure's numbers.
Default CompletedOptions CompletedCancelled

Show

Show2 controls
Show the result ofChoice
A Tool step whose result to show: as cards on channels that can draw them, as a short list elsewhere.
Intro (optional)Text
A line before the result, such as Here is what I found:

Working with step cards

Each step5 controls
Collapse step … / Expand step …Button
Folds the step's form away or opens it.
Move step … up / downButton
Changes the order.
Actions for step … > DuplicateButton
Copies the step below itself.
Actions for step … > Delete stepButton
Removes it. Deleting an If removes the steps in its Then and Otherwise branches too, after you confirm.
Needs a fixShown
Shown on a step with errors.

Collected details and variables

Ask steps (Save the answer as) and Tool steps (Save the result as (optional)) create variables, in the order the steps appear. Any text field of a later step can use them as {{name}}, including parts of a tool result such as {{rooms.0.name}}. The built-in variables, such as {{customer_name}} and {{today}}, are always available (see Procedures).

  • Using a variable before any step sets it is an error: {{token}} is used before any step sets it.
  • In text the customer sees, an unknown or empty variable becomes blank.
  • The assistant is told the first details a structured procedure collects, so when it starts the procedure it passes on what the customer already said.
  • When a workflow stage started the procedure, its answers stay readable after it ends, as {{key.variable}} and {{key.outcome}}. See Workflow building blocks.

Errors and warnings

Errors (block publishing)
  • No steps (Add at least one step.), or more than 100
  • Conditions nested more than 4 deep
  • An Ask with nothing to ask (Say what to ask for.)
  • Translations of an exact question that does not exist
  • Choices that are missing, empty, repeated, too long, or fewer than 2 or more than 10
  • A variable name that is badly formed or is a built-in variable
  • A variable used before a step sets it
  • A tool or procedure that does not exist
  • A Retry that points to a later step or a missing one
  • A language code that is not one (en, ar, fr…)
  • Sub-procedures that lead back to this procedure, so it would never end
  • Any text field over 4,000 characters
Warnings (shown only)
  • No trigger: only another procedure can start it
  • A tool switched off for this assistant
  • An If with nothing in Then (Nothing happens when this condition holds.)
  • Human handoff is off for the assistant, so Hand off steps are skipped and Ask falls back to ending the procedure

Limits

Questions people ask

Keep going
Structured procedures · HeyServo Docs