botserver/templates/broadcast.gbai/broadcast.gbdialog/broadcast.bas
Rodrigo Rodriguez (Pragmatismo) 5d21bba1e1 ``` Add KB Statistics keywords and infrastructure documentation
- Add KB Statistics keywords for Qdrant vector database monitoring: KB
  STATISTICS, KB COLLECTION STATS, KB DOCUMENTS COUNT, KB DOCUMENTS
  ADDED SINCE, KB LIST COLLECTIONS, KB STORAGE SIZE

- Add comprehensive infrastructure documentation:
  - Scaling and load balancing with LXC containers
  - Infrastructure design with encryption, sharding strategies
  - Observ
2025-11-30 16:25:51 -03:00

51 lines
1.1 KiB
QBasic

PARAM message AS STRING LIKE "Hello {name}, how are you?" DESCRIPTION "Message to broadcast, supports {name} and {mobile} variables"
PARAM listfile AS STRING LIKE "broadcast.csv" DESCRIPTION "CSV file with contacts (name, mobile columns)"
PARAM filter AS STRING LIKE "status=active" DESCRIPTION "Filter condition for contact list" OPTIONAL
DESCRIPTION "Send broadcast message to a list of contacts from CSV file"
IF NOT listfile THEN
listfile = "broadcast.csv"
END IF
IF filter THEN
list = FIND listfile, filter
ELSE
list = FIND listfile
END IF
IF UBOUND(list) = 0 THEN
TALK "No contacts found in " + listfile
RETURN 0
END IF
index = 1
sent = 0
DO WHILE index < UBOUND(list)
row = list[index]
msg = REPLACE(message, "{name}", row.name)
msg = REPLACE(msg, "{mobile}", row.mobile)
TALK TO row.mobile, msg
WAIT 5
WITH logEntry
timestamp = NOW()
user = USERNAME
from = FROM
mobile = row.mobile
name = row.name
status = "sent"
END WITH
SAVE "Log.xlsx", logEntry
sent = sent + 1
index = index + 1
LOOP
TALK "Broadcast sent to " + sent + " contacts."
RETURN sent