Media & Messaging Keywords 🟡 BETA

Keywords for displaying media content and sending messages across various channels.

Overview

These keywords handle media playback, QR code generation, and messaging operations that extend beyond the basic TALK/HEAR conversation flow.

Keywords in This Section

KeywordDescription
PLAYDisplay videos, images, documents, and presentations
QR CODEGenerate QR code images from data
SEND SMSSend SMS text messages

Quick Reference

Media Display

' Play video with controls
PLAY "training.mp4" WITH OPTIONS "controls"

' Display image fullscreen
PLAY "banner.png" WITH OPTIONS "fullscreen"

' Show PDF document
PLAY "contract.pdf"

' Display PowerPoint presentation
PLAY "slides.pptx"

QR Code Generation

' Generate basic QR code
qr_path = QR CODE "https://example.com"
SEND FILE qr_path

' Generate with custom size
qr_path = QR CODE "payment-data", 512

' WiFi QR code
wifi_data = "WIFI:T:WPA;S:MyNetwork;P:password123;;"
qr_path = QR CODE wifi_data

SMS Messaging

' Send basic SMS
SEND SMS "+1234567890", "Hello from General Bots!"

' Send with specific provider
SEND SMS phone, message, "twilio"

' Two-factor authentication
otp = RANDOM(100000, 999999)
SEND SMS user.phone, "Your code: " + otp

Channel Behavior

These keywords adapt their behavior based on the active channel:

KeywordWebWhatsAppTeamsSMS
PLAYModal playerSend as mediaAdaptive cardN/A
QR CODEDisplay inlineSend as imageEmbed in cardN/A
SEND SMSN/AN/AN/ADirect send

Configuration

SMS Providers

Configure in config.csv:

sms-provider,twilio
twilio-account-sid,YOUR_SID
twilio-auth-token,YOUR_TOKEN
twilio-phone-number,+15551234567

Supported Providers

  • Twilio - Global coverage, reliable
  • AWS SNS - AWS integration, cost-effective
  • Vonage - Good international rates
  • MessageBird - European coverage

Common Patterns

Interactive Media Training

TALK "Welcome to the training module!"
PLAY "intro-video.mp4" WITH OPTIONS "controls"

HEAR ready AS TEXT "Type 'next' when ready:"
PLAY "chapter-1.pptx"

HEAR quiz AS TEXT "What did you learn?"
' Process quiz response

QR Code Payment Flow

HEAR amount AS NUMBER "Enter payment amount:"

payment_data = GENERATE_PAYMENT_CODE(amount)
qr_path = QR CODE payment_data, 400

TALK "Scan to pay $" + amount + ":"
SEND FILE qr_path

SMS Verification

otp = RANDOM(100000, 999999)
REMEMBER "otp_" + user.id, otp, "5 minutes"

SEND SMS user.phone, "Your code: " + otp

HEAR code AS TEXT "Enter verification code:"

IF code = RECALL("otp_" + user.id) THEN
    TALK "✅ Verified!"
ELSE
    TALK "❌ Invalid code"
END IF

See Also