Complete Keyword Reference 🟑 BETA

This document provides a comprehensive reference of all BASIC keywords in General Bots, including existing implementations and planned additions.


Quick Reference Table

KeywordStatusCategoryDescription
TALKβœ… ImplementedDialogSend message to user
HEARβœ… ImplementedDialogGet input from user
WAITβœ… ImplementedDialogPause execution
PRINTβœ… ImplementedDebugDebug output
SETβœ… ImplementedVariablesSet variable value
GETβœ… ImplementedVariablesGet variable or fetch data
LETβœ… ImplementedVariablesAssign variable (classic BASIC)
SET BOT MEMORYβœ… ImplementedMemoryPersist bot-level data
GET BOT MEMORYβœ… ImplementedMemoryRetrieve bot-level data
REMEMBERβœ… ImplementedMemoryStore user-specific memory
LLMβœ… ImplementedAIQuery language model
SET CONTEXTβœ… ImplementedAIAdd context for LLM
SET USERβœ… ImplementedSessionSet user context
USE KBβœ… ImplementedKnowledgeLoad knowledge base
THINK KBβœ… ImplementedKnowledgeExplicit KB search with structured results
CLEAR KBβœ… ImplementedKnowledgeUnload knowledge base
USE WEBSITEβœ… ImplementedKnowledgeAssociate website
ADD TOOLβœ… ImplementedToolsRegister tool
USE TOOLβœ… ImplementedToolsLoad tool definition
CLEAR TOOLSβœ… ImplementedToolsRemove all tools
ADD SUGGESTIONβœ… ImplementedUIAdd clickable button
CLEAR SUGGESTIONSβœ… ImplementedUIRemove buttons
SAVEβœ… ImplementedDataSave to table
FINDβœ… ImplementedDataSearch in files
INSERTβœ… ImplementedDataInsert record
UPDATEβœ… ImplementedDataUpdate records
DELETEβœ… ImplementedDataDelete records
FILTERβœ… ImplementedDataFilter records
AGGREGATEβœ… ImplementedDataSUM, AVG, COUNT, etc.
JOINβœ… ImplementedDataJoin datasets
MERGEβœ… ImplementedDataMerge data
MAPβœ… ImplementedDataMap field names
FILLβœ… ImplementedDataFill template
PIVOTβœ… ImplementedDataCreate pivot table
GROUP BYβœ… ImplementedDataGroup data
FIRSTβœ… ImplementedDataGet first element
LASTβœ… ImplementedDataGet last element
FORMATβœ… ImplementedDataFormat values
SAVE FROM UNSTRUCTUREDβœ… ImplementedDataExtract structured data
POSTβœ… ImplementedHTTPHTTP POST
PUTβœ… ImplementedHTTPHTTP PUT
PATCHβœ… ImplementedHTTPHTTP PATCH
DELETE HTTPβœ… ImplementedHTTPHTTP DELETE
SET HEADERβœ… ImplementedHTTPSet HTTP header
CLEAR HEADERSβœ… ImplementedHTTPClear headers
GRAPHQLβœ… ImplementedHTTPGraphQL query
SOAPβœ… ImplementedHTTPSOAP call
READβœ… ImplementedFilesRead file
WRITEβœ… ImplementedFilesWrite file
DELETE FILEβœ… ImplementedFilesDelete file
COPYβœ… ImplementedFilesCopy file
MOVEβœ… ImplementedFilesMove/rename file
LISTβœ… ImplementedFilesList directory
UPLOADβœ… ImplementedFilesUpload file
DOWNLOADβœ… ImplementedFilesDownload file
COMPRESSβœ… ImplementedFilesCreate ZIP
EXTRACTβœ… ImplementedFilesExtract ZIP
GENERATE PDFβœ… ImplementedFilesGenerate PDF
MERGE PDFβœ… ImplementedFilesMerge PDFs
IF...THEN...ELSE...END IFβœ… ImplementedControlConditional
FOR EACH...NEXTβœ… ImplementedControlLoop
EXIT FORβœ… ImplementedControlExit loop
WHILE...WENDβœ… ImplementedControlWhile loop
DO...LOOPβœ… ImplementedControlDo loop
SWITCH...CASE...END SWITCHβœ… ImplementedControlSwitch
SUB...END SUBβœ… ImplementedProceduresDefine subroutine
FUNCTION...END FUNCTIONβœ… ImplementedProceduresDefine function
CALLβœ… ImplementedProceduresCall procedure
RETURNβœ… ImplementedProceduresReturn value
ONβœ… ImplementedEventsEvent handler
SET SCHEDULEβœ… ImplementedEventsSchedule execution
WEBHOOKβœ… ImplementedEventsCreate webhook
SEND MAILβœ… ImplementedCommunicationSend email
CREATE DRAFTβœ… ImplementedCommunicationCreate email draft
ADD MEMBERβœ… ImplementedCommunicationAdd to group
CREATE TASKβœ… ImplementedToolsCreate task
CREATE SITEβœ… ImplementedToolsGenerate website
BOOKβœ… ImplementedSpecialBook appointment
WEATHERβœ… ImplementedSpecialGet weather
INSTRβœ… ImplementedStringFind substring
IS NUMERICβœ… ImplementedValidationCheck if numeric
ON ERROR RESUME NEXTβœ… ImplementedErrorsEnable error trapping
ON ERROR GOTO 0βœ… ImplementedErrorsDisable error trapping
ERRORβœ… ImplementedErrorsCheck if error occurred
ERROR MESSAGEβœ… ImplementedErrorsGet error message
ERRβœ… ImplementedErrorsGet error number
CLEAR ERRORβœ… ImplementedErrorsClear error state
THROWβœ… ImplementedErrorsRaise custom error
ASSERTβœ… ImplementedErrorsAssert condition

Planned Keywords (Priority)

String Functions (Critical)

KeywordSyntaxDescriptionPriority
LENlength = LEN(string)Get string length⭐⭐⭐
LEFTresult = LEFT(string, n)Get left n characters⭐⭐⭐
RIGHTresult = RIGHT(string, n)Get right n characters⭐⭐⭐
MIDresult = MID(string, start, length)Get substring⭐⭐⭐
TRIMresult = TRIM(string)Remove whitespace⭐⭐⭐
LTRIMresult = LTRIM(string)Remove left whitespace⭐⭐
RTRIMresult = RTRIM(string)Remove right whitespace⭐⭐
UCASEresult = UCASE(string)Convert to uppercase⭐⭐⭐
LCASEresult = LCASE(string)Convert to lowercase⭐⭐⭐
REPLACEresult = REPLACE(string, old, new)Replace substring⭐⭐⭐
SPLITarray = SPLIT(string, delimiter)Split string to array⭐⭐⭐
ASCcode = ASC(char)Get ASCII code⭐⭐
CHRchar = CHR(code)Get character from code⭐⭐

Math Functions (Critical)

KeywordSyntaxDescriptionPriority
ABSresult = ABS(number)Absolute value⭐⭐⭐
ROUNDresult = ROUND(number, decimals)Round number⭐⭐⭐
INTresult = INT(number)Integer part⭐⭐⭐
SQRTresult = SQRT(number)Square root⭐⭐
MAXresult = MAX(a, b) or MAX(array)Maximum value⭐⭐⭐
MINresult = MIN(a, b) or MIN(array)Minimum value⭐⭐⭐
MODresult = a MOD bModulo/remainder⭐⭐⭐
RNDresult = RND()Random 0-1⭐⭐
RANDOMresult = RANDOM(min, max)Random in range⭐⭐⭐
CEILINGresult = CEILING(number)Round up⭐⭐
FLOORresult = FLOOR(number)Round down⭐⭐
SGNresult = SGN(number)Sign (-1, 0, 1)⭐

Date/Time Functions (Critical)

KeywordSyntaxDescriptionPriority
NOWdatetime = NOW()Current date/time⭐⭐⭐
TODAYdate = TODAY()Current date⭐⭐⭐
YEARyear = YEAR(date)Extract year⭐⭐⭐
MONTHmonth = MONTH(date)Extract month⭐⭐⭐
DAYday = DAY(date)Extract day⭐⭐⭐
HOURhour = HOUR(datetime)Extract hour⭐⭐
MINUTEminute = MINUTE(datetime)Extract minute⭐⭐
SECONDsecond = SECOND(datetime)Extract second⭐⭐
WEEKDAYdow = WEEKDAY(date)Day of week (1-7)⭐⭐
DATEADDdate = DATEADD(date, n, "day")Add to date⭐⭐⭐
DATEDIFFdays = DATEDIFF(date1, date2, "day")Date difference⭐⭐⭐
DATEVALUEdate = DATEVALUE("2025-01-15")Parse date string⭐⭐
TIMEVALUEtime = TIMEVALUE("14:30:00")Parse time string⭐⭐
EOMONTHdate = EOMONTH(date, 0)End of month⭐⭐

Type Conversion (Critical)

KeywordSyntaxDescriptionPriority
VALnumber = VAL(string)String to number⭐⭐⭐
STRstring = STR(number)Number to string⭐⭐⭐
CINTinteger = CINT(value)Convert to integer⭐⭐
CDBLdouble = CDBL(value)Convert to double⭐⭐
CSTRstring = CSTR(value)Convert to string⭐⭐
CBOOLboolean = CBOOL(value)Convert to boolean⭐⭐
CDATEdate = CDATE(value)Convert to date⭐⭐

Validation Functions (Critical)

KeywordSyntaxDescriptionPriority
ISNULLresult = ISNULL(value)Check if null⭐⭐⭐
ISEMPTYresult = ISEMPTY(value)Check if empty⭐⭐⭐
ISDATEresult = ISDATE(value)Check if valid date⭐⭐
ISARRAYresult = ISARRAY(value)Check if array⭐⭐

Array Functions (Critical)

KeywordSyntaxDescriptionPriority
ARRAYarr = ARRAY(1, 2, 3)Create array⭐⭐⭐
UBOUNDsize = UBOUND(array)Get array size⭐⭐⭐
LBOUNDstart = LBOUND(array)Get array start⭐⭐
REDIMREDIM array(10)Resize array⭐⭐
SORTsorted = SORT(array)Sort array⭐⭐⭐
UNIQUEdistinct = UNIQUE(array)Remove duplicates⭐⭐⭐
CONTAINSresult = CONTAINS(array, value)Check membership⭐⭐⭐
PUSHPUSH array, valueAdd to end⭐⭐
POPvalue = POP(array)Remove from end⭐⭐
REVERSEreversed = REVERSE(array)Reverse array⭐

Error Handling

KeywordSyntaxDescriptionStatus
ON ERROR RESUME NEXTON ERROR RESUME NEXTEnable error trappingβœ… Implemented
ON ERROR GOTO 0ON ERROR GOTO 0Disable error trappingβœ… Implemented
ERRORIF ERROR THENCheck if error occurredβœ… Implemented
ERROR MESSAGEmsg = ERROR MESSAGEGet error messageβœ… Implemented
ERRcode = ERRGet error numberβœ… Implemented
CLEAR ERRORCLEAR ERRORClear error stateβœ… Implemented
THROWTHROW "error message"Raise custom errorβœ… Implemented
ASSERTASSERT cond, "msg"Assert conditionβœ… Implemented
TRY...CATCH...END TRYTRY ... CATCH e ... END TRYStructured errorsπŸ”œ Planned

Social Media (New)

KeywordSyntaxDescriptionPriority
POST TOPOST TO "instagram" image, captionPost to social⭐⭐⭐
GET METRICSmetrics = GET INSTAGRAM METRICS "id"Get engagement⭐⭐
SCHEDULE POSTSCHEDULE POST TO "instagram" AT datetimeSchedule post⭐⭐

Marketing (New)

KeywordSyntaxDescriptionPriority
CREATE LANDING PAGECREATE LANDING PAGE "name"Build page⭐⭐⭐
ADD TO CAMPAIGNADD TO CAMPAIGN email, "name"Add to sequence⭐⭐⭐
TRACK CONVERSIONTRACK CONVERSION "campaign", "event"Track event⭐⭐
GET CAMPAIGN STATSstats = GET CAMPAIGN STATS "name"Get analytics⭐⭐

Logic Operators

KeywordSyntaxDescriptionPriority
ANDIF a AND b THENLogical ANDβœ… Implemented
ORIF a OR b THENLogical ORβœ… Implemented
NOTIF NOT a THENLogical NOTβœ… Implemented
XORresult = a XOR bExclusive OR⭐
IIFresult = IIF(condition, true, false)Inline IF⭐⭐
LIKEIF name LIKE "John*" THENPattern match⭐⭐
INIF value IN (1, 2, 3) THENSet membership⭐⭐
BETWEENIF value BETWEEN 1 AND 10 THENRange check⭐⭐

Keyword Categories

1. Dialog & Interaction

' Basic conversation
TALK "Hello! How can I help you?"
HEAR response

' Typed input
HEAR name AS STRING
HEAR age AS INTEGER
HEAR email AS EMAIL
HEAR date AS DATE
HEAR amount AS MONEY
HEAR phone AS MOBILE
HEAR confirm AS BOOLEAN

' Menu selection
HEAR choice AS "Option 1", "Option 2", "Option 3"

' File upload
HEAR document AS FILE
HEAR audio AS AUDIO
HEAR image AS IMAGE
HEAR qrcode AS QRCODE

2. Memory & Variables

' Local variables
LET name = "John"
SET age = 25

' Bot-level memory (shared across sessions)
SET BOT MEMORY "config_key", "value"
value = GET BOT MEMORY("config_key")

' User-specific memory
REMEMBER "preference", "dark_mode"

3. AI & Knowledge

' Query LLM
response = LLM "Summarize this text: " + text

' Set context for LLM
SET CONTEXT "assistant" AS "You are a helpful sales assistant."

' Load knowledge base
USE KB "product-docs"
USE KB "faq"
CLEAR KB "product-docs"
CLEAR KB

' Load website content
USE WEBSITE "https://example.com"

4. Tools & Automation

' Register tools
ADD TOOL "create-ticket"
ADD TOOL "send-email"
USE TOOL "search-database"
CLEAR TOOLS

' Create tasks
CREATE TASK "Review document", "Please review the attached file"

' Generate websites
CREATE SITE "promo" WITH TEMPLATE "landing" USING PROMPT "..."

' Create email drafts
CREATE DRAFT "user@example.com", "Subject", "Body"

5. Data Operations

' Save data (variable names = field names)
SAVE "customers.csv", name, email, phone, created

' Find data
customers = FIND "customers.csv"
active = FIND "customers.csv", "status=active"

' Filter data
highValue = FILTER customers, "amount>1000"
recent = FILTER customers, "created>=2025-01-01"

' Aggregate data
total = AGGREGATE "SUM", orders, "amount"
average = AGGREGATE "AVG", orders, "amount"
count = AGGREGATE "COUNT", orders, "id"

' Join datasets
joined = JOIN orders, customers, "customer_id"

' Group and pivot
byCategory = GROUP BY sales, "category"
pivoted = PIVOT sales, "month", "amount"

' Transform data
mapped = MAP data, "firstName->name, lastName->surname"
filled = FILL template, data

' CRUD operations
INSERT "table", data
UPDATE "table", "filter", data
DELETE "table", "filter"
MERGE "table", data, "key_field"

' Extract from text
SAVE FROM UNSTRUCTURED "contacts", unstructuredText

6. HTTP & API

' GET request
data = GET "https://api.example.com/users"

' POST request
response = POST "https://api.example.com/users", userData

' PUT request
response = PUT "https://api.example.com/users/123", userData

' PATCH request
response = PATCH "https://api.example.com/users/123", partialData

' DELETE request
response = DELETE HTTP "https://api.example.com/users/123"

' Set headers
SET HEADER "Authorization", "Bearer " + token
SET HEADER "Content-Type", "application/json"
CLEAR HEADERS

' GraphQL
result = GRAPHQL "https://api.example.com/graphql", query, variables

' SOAP
result = SOAP "https://api.example.com/service.wsdl", "Operation", params

7. File Operations

' Read/Write
content = READ "config.json"
WRITE "output.txt", content

' Copy/Move
COPY "source.txt", "backup/source.txt"
MOVE "temp.txt", "final/document.txt"

' Delete
DELETE FILE "temp/old-file.txt"

' List directory
files = LIST "documents/"

' Upload/Download
url = UPLOAD localFile, "uploads/document.pdf"
path = DOWNLOAD "https://example.com/file.pdf", "downloads/file.pdf"

' Archive
archive = COMPRESS files, "backup.zip"
extracted = EXTRACT "archive.zip", "extracted/"

' PDF operations
pdf = GENERATE PDF "template.html", data, "output.pdf"
merged = MERGE PDF pdfFiles, "combined.pdf"

8. Flow Control

' Conditional
IF age >= 18 THEN
    TALK "You are an adult."
ELSE
    TALK "You are a minor."
END IF

' Switch/Case
SWITCH category
    CASE "A"
        TALK "Category A"
    CASE "B"
        TALK "Category B"
    CASE ELSE
        TALK "Other category"
END SWITCH

' Loops
FOR EACH item IN items
    TALK item.name
NEXT item

WHILE count < 10
    count = count + 1
WEND

DO
    result = processItem()
LOOP UNTIL result = "done"

' Exit loop
FOR EACH item IN items
    IF item.skip THEN EXIT FOR
    TALK item.name
NEXT item

9. Procedures

' Define subroutine
SUB ProcessOrder(orderId)
    order = FIND "orders.csv", "id=" + orderId
    TALK "Processing order: " + order.id
END SUB

' Define function
FUNCTION CalculateTotal(items)
    total = 0
    FOR EACH item IN items
        total = total + item.price * item.quantity
    NEXT item
    RETURN total
END FUNCTION

' Call procedures
CALL ProcessOrder("ORD-001")
total = CalculateTotal(cartItems)

10. Events & Scheduling

' Event handlers
ON "new_message" CALL HandleMessage

' Scheduled jobs
SET SCHEDULE "0 8 * * *"  ' Every day at 8 AM

' Webhooks
WEBHOOK "order-received"
' Endpoint: /api/{bot}/webhook/order-received

11. Communication

' Send email
SEND MAIL "user@example.com", "Subject", "Body"

' Send to specific number
SEND MAIL TO "5521999999999", "Subject", "Body"

' Add to group
ADD MEMBER "user@example.com", "sales-team"

12. UI & Suggestions

' Add quick reply buttons
ADD SUGGESTION "help" AS "Get Help"
ADD SUGGESTION "menu" AS "Show Menu"
ADD SUGGESTION "cancel" AS "Cancel"

' Clear suggestions
CLEAR SUGGESTIONS

Input Types for HEAR

TypeExampleDescription
STRINGHEAR name AS STRINGAny text input
INTEGERHEAR age AS INTEGERWhole number
NUMBERHEAR price AS NUMBERDecimal number
BOOLEANHEAR confirm AS BOOLEANYes/No, True/False
DATEHEAR birthday AS DATEDate value
EMAILHEAR contact AS EMAILValid email address
MOBILEHEAR phone AS MOBILEPhone number
MONEYHEAR amount AS MONEYCurrency amount
HOURHEAR time AS HOURTime value
ZIPCODEHEAR zip AS ZIPCODEPostal code
LANGUAGEHEAR lang AS LANGUAGELanguage code
FILEHEAR doc AS FILEFile upload
AUDIOHEAR recording AS AUDIOAudio upload
IMAGEHEAR photo AS IMAGEImage upload
QRCODEHEAR code AS QRCODEQR code from image
LOGINHEAR user AS LOGINAuthenticated user
MenuHEAR choice AS "A", "B", "C"Selection from options

FORMAT Patterns

PatternExampleResult
YYYYFORMAT date AS "YYYY"2025
MMFORMAT date AS "MM"01
DDFORMAT date AS "DD"15
YYYY-MM-DDFORMAT date AS "YYYY-MM-DD"2025-01-15
HH:mm:ssFORMAT time AS "HH:mm:ss"14:30:00
#,##0FORMAT number AS "#,##0"1,234
#,##0.00FORMAT number AS "#,##0.00"1,234.56
0%FORMAT decimal AS "0%"75%

AGGREGATE Operations

OperationExampleDescription
SUMAGGREGATE "SUM", data, "amount"Sum of values
AVGAGGREGATE "AVG", data, "amount"Average
COUNTAGGREGATE "COUNT", data, "id"Count records
MINAGGREGATE "MIN", data, "price"Minimum value
MAXAGGREGATE "MAX", data, "price"Maximum value

Schedule Patterns (Cron)

PatternDescription
0 8 * * *Every day at 8:00 AM
0 9 * * 1Every Monday at 9:00 AM
0 0 1 * *First day of every month
*/15 * * * *Every 15 minutes
0 8,17 * * *At 8:00 AM and 5:00 PM
0 8 * * 1-5Weekdays at 8:00 AM

Best Practices

DO βœ…

' Use descriptive variable names
let customername = "John Smith"
let orderamount = 150.00

' Use SAVE with variable names as field names
SAVE "orders.csv", customername, orderamount, orderdate

' Use spaces in keywords
SET BOT MEMORY "last_order", orderid
SET CONTEXT "assistant" AS "You are helpful."
ADD SUGGESTION "help" AS "Get Help"
CLEAR SUGGESTIONS
USE KB "products"
USE TOOL "search"

' Use HEAR AS for type validation
HEAR email AS EMAIL
HEAR amount AS MONEY
HEAR confirm AS BOOLEAN

DON’T ❌

' Don't use underscores in keywords (old syntax)
SET_BOT_MEMORY "key", value  ' WRONG - use spaces

' Don't use complex object operations
SET object.field = value  ' WRONG
SAVE "table", object.id, object  ' WRONG

' Don't skip input validation
HEAR value  ' OK but less safe
' Better: HEAR value AS STRING

Migration from Old Syntax

Old SyntaxNew Syntax
SET_BOT_MEMORYSET BOT MEMORY
GET_BOT_MEMORY()GET BOT MEMORY()
SET_CONTEXTSET CONTEXT
ADD_SUGGESTIONADD SUGGESTION
CLEAR_SUGGESTIONSCLEAR SUGGESTIONS
USE_KBUSE KB
USE_TOOLUSE TOOL
CLEAR_KBCLEAR KB
CLEAR_TOOLSCLEAR TOOLS
SET_SCHEDULESET SCHEDULE
SET_HEADERSET HEADER
CLEAR_HEADERSCLEAR HEADERS
DELETE_HTTPDELETE HTTP
DELETE_FILEDELETE FILE
GENERATE_PDFGENERATE PDF
MERGE_PDFMERGE PDF
GROUP_BYGROUP BY
SAVE_FROM_UNSTRUCTUREDSAVE FROM UNSTRUCTURED

Last updated: January 2025