Let the AI route the conversation (and book meetings)

An AI answer can do more than answer a question: it can also decide where the conversation goes next. The visitor asks in their own words, the AI answers, and when the visitor clearly wants something your bot has a flow for (booking a meeting, a quote, support), the AI ends its answer with a short command. The bot reads that command and jumps to the flow. The visitor never sees the command.

Try it: open the demo bot. Ask about the products, then say you’d like to book a call, ask for a price offer, or report a problem.

What you need

  • The OpenAI integration and an assistant, see Complete chat with OpenAI.
  • A bot variable of type Chat Completion (in this example demoAI) that sends the visitor’s question, in both the initial and the follow-up parameters:
{
    "input": [
        {
            "role": "user",
            "content": "{{question}}"
        }
    ]
}

Step 1. Tell the assistant which commands to use

Add a section like this to the assistant’s instructions, with one command per flow your bot has:

ROUTING
After your answer, decide what the visitor wants and, only in these cases, end your answer with exactly one marker:
- They want a meeting, a call, a demo or a consultation: end with <!-- #BOOK -->
- They want a price quote or an offer: end with <!-- #QUOTE -->
- They have a problem with a product they own, an order or a delivery: end with <!-- #SUPPORT -->
- Their request is unclear, or they ask what you can do: end with <!-- #MENU -->
In those cases write one short sentence saying what happens next (for example "Let's find a time for your meeting."), then the marker on its own at the very end, exactly as shown. Otherwise add no marker.

Written as an HTML comment, the command is part of the answer but is not shown in the chat.

Step 2. The question

A Long text step with the code name question, where the visitor types. Its next step is the GoTo step below.

Step 3. One GoTo step shows the answer and routes on it

Add a GoTo step and set it up like this:

  • Bot messages: a chat text of the type Variable stream with the variable demoAI, so the answer appears while it is being written.
  • Answer value (in the Step settings): {{demoAI}}. The answer is kept once it has been generated, so the value is exactly the text the visitor just read, without a second request to OpenAI.
  • Bot responses, each with Advanced conditions on this same step:
    • ends with (case-sensitive) #BOOK --> → the first step of the booking flow
    • ends with (case-sensitive) #QUOTE --> → the quote flow
    • ends with (case-sensitive) #SUPPORT --> → the support flow
    • ends with (case-sensitive) #MENU --> → a Multiple choice step with your options, so an unclear request never guesses
  • Default next step: back to the question step, so the visitor can simply ask the next thing.

“Ends with” ignores trailing spaces and the closing HTML tags around the answer, so it matches the command at the very end. More about the operators: Advanced conditional jump logic.

Step 4. The flows

Each flow is a few ordinary steps (name, e-mail, a description) that ends with a Multiple choice step such as “Ask another question” (back to the question step) or “Main menu”. What the visitor answers in a flow is kept for the whole conversation: use it in any text as {{code_name}}, for example “Thanks, {{quote_name}}! We’ll send your quote to {{quote_email}}.”

Booking a meeting right in the chat

In the booking flow, ask for the name and e-mail, then add a Fold-out step that shows your booking page, with the answers passed in its address:

https://calendly.com/<your-page>/30min?name={{book_name}}&email={{book_email}}

Calendly shows the real free times from your connected calendar, creates the event with a Google Meet link, sends the invitation, and lets the visitor reschedule or cancel it later. The visitor doesn’t type their name and e-mail twice. The Fold-out step then asks “Did you book a time?” and the conversation continues. If a booking page refuses to be shown inside the chat, set the Fold-out step’s display to Window. More: Book a meeting via Calendly and Quriobot.

Good to know

  • Each answer is one request to your own OpenAI account.
  • The command is saved with the answer’s value. In the results, the answer is shown as text, without the hidden command.
  • When the conversation loops back to the question, the results keep the latest answer of each step.

Edit this page