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.
- The procedure starts. The request matches the trigger. The first step is an Ask, so the run waits for the answer.
- Answer, tool, choice. The answer is saved, the tool runs straight away, and the next Ask shows its choices as buttons.
- 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?
- 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
- 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
Click AddNew structured procedure
Name it (for example
Verify identity), pick a folder if you like, and click Create. - 2
Write the Trigger
When the assistant should start it, from the customer's side. Leave it empty for a sub-procedure.
- 3
Click Add step and choose a type
Add the steps in the order they should run. Each step opens its own form.
- 4
Save the answers you need later
Give Ask and Tool steps a variable name, then use it in later steps as
{{name}}. - 5
Fix what the editor flags
A step with errors shows
Needs a fix. The list above the steps countsErrors to fix before publishing. - 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 is | What happens | In the trace |
|---|---|---|
| An answer | It 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 else | The 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 stop | The run ends as cancelled. | The customer called it off |
| An answer that does not fit | The 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
| Step | What it does |
|---|---|
| Ask | Ask the customer for something and wait for the answer. |
| Tell | Tell the customer something, phrased by the assistant. |
| Say | Send exact words, with a version per language. |
| If | Branch on an answer or on a question for the assistant. |
| Tool | Call a tool and keep its result. |
| Sub-procedure | Run another procedure here. |
| Hand off | Hand the conversation to a person. |
| End conversation | Say goodbye and close the conversation. |
| Retry | Go back to an earlier step, a few times at most. |
| End procedure | Finish the procedure here. |
| Show | Show a tool's result as cards where the channel can. |
Ask
- 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 ascustomer_name.Limit 40 characters - Answer typeChoice
- How the answer is checked (see the table below).Default
TextOptionsTextNumberYes 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 personOptionsHand 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 type | What is accepted |
|---|---|
| Text, Name | Any text, trimmed, up to 500 characters |
| Number | A number. Arabic-Indic digits are accepted and thousands commas are removed. |
| Yes or no | Yes and no words in English and Arabic, such as yes, ok, sure, نعم, تمام, no, nope, لا |
| Choice | The choice tapped or typed, its number (1, 2, …), or the only choice the message mentions |
| Date | A date, saved as YYYY-MM-DD |
| Time | A time, saved as HH:MM on the 24-hour clock |
| A valid email address | |
| Phone number | Digits with an optional +, at least 7 |
Tell
- 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
- Exact textText
- Sent as written. Use
{{variable}}to fill in an answer, for exampleThanks! 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
- 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
- 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 onOptionsSay 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
- Procedure to runChoice
- Another procedure of this assistant. A structured one runs here step by step; a free-form one takes over.
Hand off
- 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
- Goodbye message (optional)Text
- Sent before the conversation closes. Empty: the assistant says goodbye in its own words.
Retry
- 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
- Ends asChoice
- Counted in the procedure's numbers.Default
CompletedOptionsCompletedCancelled
Show
- 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
- 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
- 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
- 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