botserver/docs/src/chapter-06-gbdialog/templates/start.md
Rodrigo Rodriguez (Pragmatismo) 635f3a7923 Looking at this diff, I need to summarize the significant documentation
and code changes:

``` Add natural language scheduling, docs, wizard, and branding

- Add SET SCHEDULE natural language parser supporting patterns like
  "every hour", "at 9am", "weekdays at 8am", "business
2025-11-30 12:20:48 -03:00

8 KiB

Start Template

The start template is the simplest possible bot - a greeting flow that demonstrates the core interaction pattern of BASIC: greeting users and responding to their input.

Topic: Basic Greeting & Help Flow

This template is perfect for:

  • Learning BASIC fundamentals
  • Simple FAQ bots
  • Quick demos
  • Starting point for more complex bots

The Code

REM Basic greeting and help flow
SET user_name = "Guest"

TALK "Hello, " + user_name + "! How can I help you today?"
HEAR user_input

IF user_input = "help" THEN
    TALK "Sure, I can assist with account info, orders, or support."
ELSE
    TALK "Sorry, I didn't understand. Type 'help' for options."
END IF

Sample Dialogs

These conversations show how the start template works in real-world scenarios.

Dialog 1: User Asks for Help

🤖
Helper Bot
online
Today
Helper Bot

Hello, Guest! How can I help you today? 👋

09:15

help

09:15

Sure, I can assist with account info, orders, or support. 📋

09:15

Dialog 2: Unknown Input

🤖
Helper Bot
online
Helper Bot

Hello, Guest! How can I help you today? 👋

11:30

what's the weather?

11:30

Sorry, I didn't understand. Type 'help' for options.

11:30

help

11:31

Sure, I can assist with account info, orders, or support. 📋

11:31

Dialog 3: Personalized Greeting (Enhanced Version)

When you add user detection, the experience improves:

🤖
Smart Helper
online
Smart Helper

Hello, Maria! 👋 How can I help you today?

14:20

I need help with my order

14:20

Of course, Maria! I found your recent order #12345.

📦 Status: Shipped

🚚 Delivery: Tomorrow by 6pm

Is there anything specific about this order?

14:20

Keywords Used

Keyword Purpose
SET Assign a value to a variable
TALK Send a message to the user
HEAR Wait for and capture user input
IF/ELSE Conditional branching based on input

How It Works

  1. Variable Setup: SET creates a variable to hold the user's name
  2. Greeting: TALK sends the welcome message
  3. Input Capture: HEAR waits for user response
  4. Response Logic: IF/ELSE determines what to say back

Enhanced Version

Here's the same template enhanced with LLM for natural understanding:

REM Smart greeting flow with LLM
SET user_name = "Guest"

TALK "Hello, " + user_name + "! How can I help you today?"
HEAR user_input

' Let LLM understand intent
intent = LLM "Classify this user message into one category: help, account, orders, support, other. Message: " + user_input

SWITCH intent
    CASE "help"
        TALK "I can assist with account info, orders, or support."
    CASE "account"
        TALK "Let me pull up your account information..."
    CASE "orders"
        TALK "I'll check on your recent orders..."
    CASE "support"
        TALK "Connecting you with our support team..."
    DEFAULT
        response = LLM "Respond helpfully to: " + user_input
        TALK response
END SWITCH

Customization Ideas

Add User Detection

' Get user info if available
user_name = GET BOT MEMORY "user_" + user_id + "_name"
IF user_name = "" THEN
    TALK "Hi there! What's your name?"
    HEAR user_name
    SET BOT MEMORY "user_" + user_id + "_name", user_name
END IF

TALK "Welcome back, " + user_name + "!"

Add Quick Reply Buttons

ADD SUGGESTION "Account Info"
ADD SUGGESTION "My Orders"
ADD SUGGESTION "Get Support"
TALK "What would you like help with?"
HEAR choice

Add Time-Based Greeting

hour = HOUR(NOW())
IF hour < 12 THEN
    greeting = "Good morning"
ELSE IF hour < 18 THEN
    greeting = "Good afternoon"
ELSE
    greeting = "Good evening"
END IF

TALK greeting + ", " + user_name + "!"