SparkWA technical reference
SparkWA routes authorized WhatsApp messages through a self-hosted Go bridge and Gmail to a configured Gemini Spark workflow. This reference documents setup, operation, and security considerations.
apt and immediately launches the interactive TUI dashboard. Reopen anytime with sparkwa.
System Integration Pipeline
SparkWA uses sender validation, task correlation, and scoped OAuth access. Review the security guide and deployment configuration before handling sensitive messages.
WhatsApp Bot
Dedicated secondary WhatsApp SIM account. Connects headlessly via terminal QR code.
Authorized User
Your personal WhatsApp number. Only this number is permitted. Strangers are rejected.
Gmail Bridge
Secure Google Cloud OAuth 2.0 mailbox on VPS that delivers commands to Gemini Spark.
Gemini Spark
Your autonomous AI agent in Google Workspace with direct access to Docs, Drive & Calendar.
Architectural Message Flow Diagram
End-to-end execution path between your personal WhatsApp and Gemini Spark
- Verifies sender matches Number 2 (strangers dropped silently)
- Saves task to local SQLite database (/var/lib/sparkwa/sparkwa.db)
- Formats email protocol RFC-2822:
[SPARKWA:TASK_ID] - Sends email via official Google Cloud OAuth 2.0 Gmail API
Master Gemini Spark System Prompt
Copy and paste this exact instruction into your Gemini Custom Instructions, Gem instructions, or Scheduled Task. It gives Spark permanent standing authorization so it never pauses to ask "Should I send this email?", never echoes command envelopes, and always delivers the direct answer to your WhatsApp.
You are an autonomous execution worker integrated with SparkWA. You run 24/7 in the background without requiring manual human supervision. You receive automated tasks via incoming emails with subjects formatted as: [SPARKWA:REQUEST_ID] <Short Title> The email body will follow this format: BEGIN SPARKWA COMMAND Request ID: <REQUEST_ID> Authorized sender: <MASKED_PHONE> Timestamp: <ISO8601> Command: <USER_INSTRUCTION> END SPARKWA COMMAND OPERATING PROTOCOL: 1. IMMEDIATE AUTONOMOUS EXECUTION (24/7): - You have standing, permanent authorization to execute tasks and send reply emails automatically. - NEVER ask "Should I send this email?", "Do you want me to reply?", or "Shall I proceed?". - NEVER pause or wait for user confirmation to send the email response. Send the email reply directly and immediately to the sender. 2. NEVER ECHO OR QUOTE THE INPUT: - NEVER repeat, quote, or echo the "BEGIN SPARKWA COMMAND" block in your reply. - Extract only the text after "Command: " and treat it as the real instruction to execute. - If the command is a conversational greeting (e.g., "Hi", "Hello"), reply directly and politely. - If the command is a query, answer it thoroughly. - If the command requires Google Workspace tools (Gmail, Drive, Docs, Sheets, Calendar), use them directly to complete the task. 3. STRICT RESPONSE FORMAT: Always reply directly to the email thread using this exact structure: BEGIN SPARKWA RESPONSE Request ID: <REQUEST_ID> Status: SUCCESS Result: <YOUR DIRECT ANSWER, SUMMARY, OR OUTPUT> END SPARKWA RESPONSE - Replace <REQUEST_ID> with the exact Request ID from the incoming email. - Put your actual answer or output after "Result: ". - Do not include extra conversational text outside of this block. 4. SAFETY GUARDRAILS (DESTRUCTIVE ACTIONS ONLY): - Only if a command asks for an irreversible or high-risk action (such as deleting files, mass-emailing clients, or financial transactions), do NOT execute it immediately. - Instead, respond with: BEGIN SPARKWA RESPONSE Request ID: <REQUEST_ID> Status: APPROVAL_REQUIRED Result: This action requires your confirmation: [brief description]. Reply YES to confirm. END SPARKWA RESPONSE
WhatsApp Slash Commands
Send these commands from your authorized personal WhatsApp number directly to the bot account:
| Command | Action | Expected Response |
|---|---|---|
| Latency & responsiveness diagnostic | Instant pong reply with server UTC timestamp | |
| System integration & capability audit | Live health check for WhatsApp, Gmail, and Gemini Spark | |
| Inspect recent tasks in SQLite queue | Compact table of recent task IDs, flows, and states | |
| Inspect details of a specific task | Full execution timestamps, Gmail thread ID, and results | |
| Cancel an active pending task | Marks the task cancelled and cancels outbound worker dispatch | |
| Quick command cheatsheet | Displays the full operational command guide |
Example Prompts for Gemini Spark
Any natural language text sent from your authorized personal WhatsApp is delivered directly to Gemini Spark. Spark executes actions using Google Workspace APIs and streams answers back to chat.
Schedule Calendar Sync
Schedule a 30-minute sync with Alex tomorrow at 3:00 PM and invite alex@company.com
Spark Action: Checks your calendar for schedule collisions, books the event with a Google Meet link, sends calendar invitations, and returns meeting confirmation to WhatsApp.
Morning Daily Agenda
What meetings and tasks do I have scheduled for today and tomorrow morning?
Spark Action: Aggregates events from Google Calendar and to-dos from Google Tasks, organizes them into a chronological agenda, and delivers it to your chat.
Reschedule Existing Meeting
Move my 2:00 PM team review today to Thursday at 11:00 AM.
Spark Action: Locates the calendar entry, checks attendee availability, updates start/end timestamps, and dispatches automated update notices.
Inbox Priority Summary
Summarize my unread emails from the past 24 hours. Highlight any urgent emails from clients or management.
Spark Action: Scans incoming messages, filters newsletters and spam, produces bullet summaries for key threads, and flags urgent action items.
Draft Email Reply
Draft a polite reply to Sarah's email regarding the product roadmap delay, confirming we will ship on Friday.
Spark Action: Drafts the response directly into your Gmail account, formats it appropriately, and provides a preview back to WhatsApp for your review.
Append Spreadsheet Row
Add a row to the '2026 Expense Log' spreadsheet: Nov 3, Client Lunch, $64.20, Paid via Visa.
Spark Action: Accesses the spreadsheet in Google Drive, maps columns accurately, appends the entry, and reports the updated sheet total.
Search Google Drive Files
Find the latest 'Q4 Financial Review' presentation in my Google Drive and summarize key revenue milestones.
Spark Action: Locates the file in Google Drive, analyzes slide text and charts, and produces an executive briefing delivered directly to your chat.
Destructive Action Safety Guardrail
Draft an announcement email to all team leads about Friday server maintenance.
Task: 256c0c48
Action: Send announcement email to team-all@company.com (18 recipients).
Reply with your confirmation or cancellation.
Spark Action: Detects external high-impact action, pauses execution, and demands your confirmation before sending.
Documentation Guides & Reference Manuals
Explore dedicated technical reference manuals for installation, OAuth credential provisioning, prompt engineering, security architecture, and operational troubleshooting.
Gemini Spark Setup Guide
Comprehensive instructions for Google Gemini Spark standing authorization, workspace tool bindings, and autonomous task loops.
Gmail OAuth 2.0 Credentials
Step-by-step walkthrough to create a Google Cloud Project, enable Gmail API scopes, and download desktop client credentials.
VPS Installation & Service
Production deployment guide covering systemd sandboxing, APT repository integration, automated updates, and log inspection.
Security & Privacy Model
Deep dive into fail-closed allowlisting, cryptographic token isolation, credential permission boundaries, and zero-shell guarantees.
Diagnostics & Troubleshooting
Solutions for QR code pairing timeout, Gmail OAuth token expiration, SQLite queue recovery, and WhatsApp connection reconnects.
Security & Privacy Architecture
SparkWA is engineered for fail-closed, multi-tenant safety. Your server is completely isolated.
[SHIELD] Strict Allowlist Only
SparkWA enforces strict fail-closed phone authorization. Messages from unauthorized phone numbers, group chats, broadcasts, or bots are dropped immediately with zero execution.
[LOCK] Zero Shell Execution
SparkWA contains zero shell evaluation (no sh -c or exec.Command on user input). All tasks are purely routed via structured Google API requests.
[BOX] Systemd Linux Sandboxing
Runs under strict Linux sandboxing: ProtectSystem=strict, ProtectHome=yes, NoNewPrivileges=yes, and PrivateTmp=yes.
[EYE] Total Privacy Masking
Phone numbers, email addresses, and command contents are scrubbed from TUI screens and daemon logs, preventing unauthorized shoulder-surfing on shared VPS terminals.
Frequently Asked Questions
Do I need to leave my laptop on?
No. SparkWA runs 24/7 in the background on your Linux VPS (or Raspberry Pi). Your laptop can be closed or turned off.
Does SparkWA require Docker, Node.js, Python, or Chromium?
No. SparkWA is written in pure Go and compiled into a single static binary. It has zero external software dependencies.
How much RAM does it need?
SparkWA uses approximately 28 MB to 35 MB of RAM at idle. It runs reliably on the smallest 512 MB or 1 GB VPS instances.
What happens if my VPS reboots?
The systemd service unit automatically starts SparkWA on boot, reconnects WhatsApp and Gmail, and recovers any pending tasks from the embedded SQLite database.