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
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
Hello, Guest! How can I help you today? 👋
help
Sure, I can assist with account info, orders, or support. 📋
Dialog 2: Unknown Input
Hello, Guest! How can I help you today? 👋
what's the weather?
Sorry, I didn't understand. Type 'help' for options.
help
Sure, I can assist with account info, orders, or support. 📋
Dialog 3: Personalized Greeting (Enhanced Version)
When you add user detection, the experience improves:
Hello, Maria! 👋 How can I help you today?
I need help with my order
Of course, Maria! I found your recent order #12345.
📦 Status: Shipped
🚚 Delivery: Tomorrow by 6pm
Is there anything specific about this order?
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
- Variable Setup:
SETcreates a variable to hold the user's name - Greeting:
TALKsends the welcome message - Input Capture:
HEARwaits for user response - Response Logic:
IF/ELSEdetermines 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 + "!"
Related Templates
- enrollment.bas - Multi-step data collection
- auth.bas - User authentication patterns