botserver/templates
Rodrigo Rodriguez (Pragmatismo) a41ff7a7d4 Add documentation and core BASIC language functions
- Add SET_SCHEDULE.md and TEMPLATE_VARIABLES.md documentation
- Implement array functions (CONTAINS, PUSH/POP, SLICE, SORT, UNIQUE)
- Implement math functions module structure
- Implement datetime functions module structure
- Implement validation functions (ISNULL, ISEMPTY, VAL, STR, TYPEOF)
- Implement error handling functions (THROW, ERROR, ASSERT)
- Add CRM lead scoring keywords (SCORE_LEAD, AI_SCORE_LEAD)
- Add messaging keywords (SEND_TEMPLATE, CREATE_TEMPLATE)
2025-11-30 11:09:16 -03:00
..
ai-search.gbai - From 4 to 7. 2025-11-23 20:12:09 -03:00
announcements.gbai Looking at this diff, I can see it's a comprehensive documentation 2025-11-30 10:53:59 -03:00
api-client.gbai/api-client.gbdialog Fix typos in bot file extensions and keyword names 2025-11-26 22:54:22 -03:00
auth HTMX enters. 2025-11-29 16:29:28 -03:00
backup.gbai - New keywords. 2025-11-21 10:44:29 -03:00
bi.gbai/bi.gbai - New keywords. 2025-11-21 10:44:29 -03:00
broadcast.gbai/broadcast.gbdialog - New keywords. 2025-11-21 10:44:29 -03:00
crawler.gbai/crawler.gbot - New keywords. 2025-11-21 10:44:29 -03:00
crm Looking at this diff, I can see it's a comprehensive documentation 2025-11-30 10:53:59 -03:00
crm.gbai/crm.gbdialog - New templates. 2025-11-22 01:27:29 -03:00
default.gbai Add multimodal module for botmodels integration 2025-11-29 20:40:08 -03:00
edu.gbai - New keywords. 2025-11-21 10:44:29 -03:00
erp.gbai/erp.gbdialog - New templates. 2025-11-22 01:27:29 -03:00
hr/employees.gbai Looking at this diff, I can see it's a comprehensive documentation 2025-11-30 10:53:59 -03:00
it/helpdesk.gbai Looking at this diff, I can see it's a comprehensive documentation 2025-11-30 10:53:59 -03:00
law.gbai - New keywords. 2025-11-21 10:44:29 -03:00
llm-server.gbai - New keywords. 2025-11-21 10:44:29 -03:00
llm-tools.gbai - New keywords. 2025-11-21 10:44:29 -03:00
marketing.gbai/marketing.gbdialog Add documentation and core BASIC language functions 2025-11-30 11:09:16 -03:00
office.gbai Looking at this diff, I can see it's a comprehensive documentation 2025-11-30 10:53:59 -03:00
partials HTMX enters. 2025-11-29 16:29:28 -03:00
public-apis.gbai Fix typos in bot file extensions and keyword names 2025-11-26 22:54:22 -03:00
reminder.gbai - New keywords. 2025-11-21 10:44:29 -03:00
store.gbai - New keywords. 2025-11-21 10:44:29 -03:00
talk-to-data.gbai - New keywords. 2025-11-21 10:44:29 -03:00
template.gbai - New keywords. 2025-11-21 10:44:29 -03:00
whatsapp.gbai - New keywords. 2025-11-21 10:44:29 -03:00
base.html HTMX enters. 2025-11-29 16:29:28 -03:00
chat.html HTMX enters. 2025-11-29 16:29:28 -03:00
drive.html HTMX enters. 2025-11-29 16:29:28 -03:00
home.html HTMX enters. 2025-11-29 16:29:28 -03:00
mail.html HTMX enters. 2025-11-29 16:29:28 -03:00
meet.html HTMX enters. 2025-11-29 16:29:28 -03:00
README.md Looking at this diff, I can see it's a comprehensive documentation 2025-11-30 10:53:59 -03:00
tasks.html HTMX enters. 2025-11-29 16:29:28 -03:00
TEMPLATE_PLAN.md Looking at this diff, I can see it's a comprehensive documentation 2025-11-30 10:53:59 -03:00
tools.html Add desktop tools, antivirus, and editor modules 2025-11-29 21:23:19 -03:00

General Bots Templates

The General Bots Templates provide ready-to-use business solutions powered by conversational AI. Each template includes pre-configured dialogs, database schemas, scheduled jobs, webhooks, and tools that can be customized for your specific needs.

📁 Template Structure

Each template follows this standard structure:

template-name.gbai/
├── template-name.gbdialog/     # BASIC scripts (.bas files)
│   ├── start.bas               # Initial setup, tools, welcome message
│   ├── tables.bas              # Database schema definitions
│   ├── *-jobs.bas              # Scheduled automation jobs
│   └── *.bas                   # Tool implementations
├── template-name.gbot/         # Bot configuration
│   └── config.csv              # Theme, prompts, settings
├── template-name.gbkb/         # Knowledge base content
├── template-name.gbdrive/      # Document templates, assets
└── template-name.gbdata/       # Initial data files

🏷️ Template Categories

Category Icon Description
CRM & Sales 💼 Customer relationships, leads, opportunities, sales pipeline
Operations & ERP 🏭 Inventory, purchasing, supply chain, production
Human Resources 👥 Employees, attendance, leave, recruitment
Finance & Accounting 💰 Invoicing, expenses, budgets, billing
Healthcare & Medical 🏥 Patients, appointments, pharmacy, medical billing
Education & Training 🎓 Students, courses, enrollment, faculty
Real Estate 🏠 Properties, leases, tenants, maintenance
Legal & Compliance ⚖️ Cases, contracts, compliance tracking
Events & Scheduling 📅 Events, room/desk booking, reservations
IT & Support 🖥️ Helpdesk, tickets, assets, bug tracking
Marketing 📢 Campaigns, content, social media, broadcasts
Nonprofit 🤝 Donors, volunteers, memberships, fundraising
AI & Data 🤖 Search, crawling, talk-to-data, LLM tools

📋 Available Templates

💼 CRM & Sales

Template Folder Description Key Features
CRM crm.gbai Complete CRM system Lead management, opportunity tracking, case management, quotes, email campaigns
Store store.gbai E-commerce checkout Product catalog, cart, checkout flow

🏭 Operations & ERP

Template Folder Description Key Features
ERP erp.gbai Enterprise resource planning Inventory management, purchasing, warehouse operations

👥 Human Resources

Template Folder Description Key Features
Employees hr/employees.gbai Employee management system Directory, onboarding, org chart, emergency contacts, document tracking

🎓 Education & Training

Template Folder Description Key Features
Education edu.gbai Educational enrollment Student enrollment, course management, data collection
Template Folder Description Key Features
Law law.gbai Legal case management Case summaries, document querying, legal research

🖥️ IT & Support

Template Folder Description Key Features
Helpdesk it/helpdesk.gbai IT support ticketing Ticket creation, SLA tracking, escalation, webhooks for integration

📢 Marketing & Communications

Template Folder Description Key Features
Marketing marketing.gbai Marketing automation Social posting, broadcasts, content ideas
Announcements announcements.gbai Company communications News distribution, scheduled summaries
Broadcast broadcast.gbai Message broadcasting Multi-channel broadcasts

🤖 AI & Data

Template Folder Description Key Features
AI Search ai-search.gbai Document search & QR PDF search, QR code scanning, AI summaries
Crawler crawler.gbai Website data extraction Web crawling, knowledge updates
Talk to Data talk-to-data.gbai Natural language SQL Query databases in plain English, charts
LLM Server llm-server.gbai LLM as REST API API generation for LLM access
LLM Tools llm-tools.gbai Custom LLM integration Real-time data access, custom logic
BI bi.gbai Business intelligence Dashboards, analytics

🔧 Utility Templates

Template Folder Description Key Features
Default default.gbai Base template Starting point for custom bots
Office office.gbai Office automation Document processing, API integration, data sync
Reminder reminder.gbai Reminder system Scheduled reminders
Backup backup.gbai Data backup Automated backups
API Client api-client.gbai API consumption External API integration
Public APIs public-apis.gbai Public API access Common public API integrations
WhatsApp whatsapp.gbai WhatsApp integration WhatsApp-specific features

🔧 Key Components

start.bas - Template Initialization

Every template should have a start.bas that:

  1. Registers Tools - Makes functions available to the AI
  2. Sets Up Knowledge Base - Loads relevant KB content
  3. Configures Context - Sets the AI personality/role
  4. Adds Suggestions - Provides quick-action buttons
  5. Displays Welcome - Greets users with capabilities
' Example start.bas structure
ADD TOOL "create-ticket"
ADD TOOL "search-tickets"

USE KB "helpdesk.gbkb"

SET_CONTEXT "helpdesk" AS "You are an IT support assistant..."

CLEAR_SUGGESTIONS
ADD_SUGGESTION "new" AS "Create new ticket"
ADD_SUGGESTION "status" AS "Check ticket status"

BEGIN TALK
    Welcome to IT Helpdesk!
    How can I help you today?
END TALK

BEGIN SYSTEM PROMPT
    You are an IT support assistant...
END SYSTEM PROMPT

tables.bas - Database Schema

Define your data model using the TABLE keyword:

TABLE employees
    id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
    first_name VARCHAR(100) NOT NULL
    last_name VARCHAR(100) NOT NULL
    email VARCHAR(255) UNIQUE NOT NULL
    department_id UUID REFERENCES departments(id)
    hire_date DATE NOT NULL
    is_active BOOLEAN DEFAULT TRUE
    created_at TIMESTAMP DEFAULT NOW()
END TABLE

*-jobs.bas - Scheduled Automation

Set up recurring tasks with SET SCHEDULE:

PARAM job_name AS STRING

IF job_name = "daily_report" THEN
    ' Generate and send daily report
    ...
END IF

IF job_name = "setup_schedules" THEN
    SET SCHEDULE "0 8 * * *" "jobs.bas" "daily_report"
    SET SCHEDULE "0 18 * * *" "jobs.bas" "end_of_day"
    TALK "Schedules configured"
END IF

Webhook Scripts

Expose scripts as HTTP endpoints:

WEBHOOK "ticket-webhook"

PARAM action AS STRING
PARAM ticket_number AS STRING
...

' Validate API key
api_key = GET "webhook.headers.X-API-Key"
IF api_key != expected_key THEN
    RETURN #{ status: 401, error: "Unauthorized" }
END IF

' Process webhook
IF action = "create" THEN
    ...
END IF

Tool Scripts

Functions that AI can call (registered with ADD TOOL):

PARAM name AS STRING LIKE "John" DESCRIPTION "Employee name"
PARAM email AS STRING LIKE "john@co.com" DESCRIPTION "Email address"

DESCRIPTION "Creates a new employee record in the system"

' Implementation
employee = CREATE OBJECT
SET employee.name = name
SET employee.email = email
...
SAVE "employees", employee.id, employee

RETURN #{ success: true, employee_id: employee.id }

🚀 Getting Started

1. Choose a Template

Browse the categories above and select a template that matches your use case.

2. Copy to Your Bot

cp -r templates/hr/employees.gbai your-bot.gbai

3. Customize

  • Edit config.csv for branding (colors, logo, title)
  • Modify tables.bas for your data model
  • Update tools in .gbdialog/ for your workflow
  • Add content to .gbkb/ for AI knowledge

4. Initialize

Run the template's setup job to configure schedules:

' In conversation or via API
RUN "jobs.bas" WITH job_name = "setup_schedules"

📖 Available Keywords

Templates use these BASIC keywords:

Data Operations

  • SAVE, INSERT, UPDATE, DELETE, MERGE
  • FIND, FILTER, MAP, JOIN, GROUP_BY
  • IMPORT, EXPORT (CSV, JSON, Excel)
  • FILL (template filling)

Communication

  • TALK, HEAR - Conversation
  • SEND MAIL - Email
  • SEND_SMS - Text messages
  • BROADCAST - Multi-recipient

Scheduling & Tasks

  • SET SCHEDULE - Cron jobs
  • CREATE_TASK - Task management
  • BOOK - Calendar booking

AI & LLM

  • LLM - Call language model
  • CALCULATE - LLM-based calculations
  • VALIDATE - LLM-based validation
  • TRANSLATE - Translation
  • SUMMARIZE - Text summarization
  • EXTRACT_DATA - Data extraction

Files & Documents

  • READ, WRITE, COPY, MOVE
  • GENERATE_PDF, MERGE_PDF
  • COMPRESS, EXTRACT
  • UPLOAD, DOWNLOAD

Integrations

  • POST, PUT, PATCH, DELETE - HTTP
  • GRAPHQL, SOAP - API protocols
  • WEBHOOK - Expose endpoints
  • QR_CODE - Generate QR codes

Multimedia

  • IMAGE, VIDEO, AUDIO - Generation
  • SEE - Vision/captioning

📊 Template Feature Matrix

Template Tools Schedules Webhooks KB Drive
CRM
ERP
Employees
Helpdesk
Education
AI Search
Announcements
Marketing

🔗 Resources


📝 Creating Custom Templates

  1. Start from default.gbai or copy an existing template
  2. Define your data model in tables.bas
  3. Create tools for your business logic
  4. Set up scheduled jobs for automation
  5. Add webhooks for external integrations
  6. Configure start.bas for initialization
  7. Add knowledge base content for AI context

General Bots Templates - Conversational AI for Business