Skill v1.0.0
currentAutomated scan100/100name: elevenlabs-conversational-agent description: "Use for ElevenLabs voice agents with Supabase webhooks." category: mlops tags: [elevenlabs, voice-agent, twilio, supabase, edge-functions, webhook, telegram, eu-ai-act] metadata: version: "1.0.0"
ElevenLabs Conversational Agent
Build production-ready voice agents using ElevenLabs Conversational AI, Supabase Edge Functions, and Hermes Agent.
Architecture Overview
Caller → Twilio → ElevenLabs Agent│├── Personalization Webhook (Edge Function)│ ├── Check priority window (time + weekday)│ ├── Return dynamic_variables to agent│ └── Send Telegram notification to owner│└── Post-Call Webhook (Edge Function)├── Validate + deduplicate by call_sid└── INSERT into Supabase call_log (RPC)
Components
1. Supabase Backend
Table: public.hermes2_call_log (or your schema) RPC: public.insert_call_log() — SECURITY DEFINER, handles upsert
CREATE TABLE public.hermes2_call_log (id UUID PRIMARY KEY DEFAULT gen_random_uuid(),call_sid TEXT NOT NULL UNIQUE,caller_number TEXT NOT NULL,started_at TIMESTAMPTZ NOT NULL,duration_seconds INTEGER DEFAULT 0,category TEXT,priority BOOLEAN DEFAULT FALSE,outcome TEXT,ticket_id TEXT,transcript TEXT, -- NULL unless explicit consent givencreated_at TIMESTAMPTZ DEFAULT now());
2. Edge Function #1 — Personalization Webhook
Called by ElevenLabs at call start. Returns dynamic_variables to the agent.
Input: { caller_id, agent_id, called_number, call_sid } Output: { dynamic_variables: { priority_window, priority_window_start, priority_window_end, timezone } }
Logic:
- Pure clock check — no LLM, no DB call
- Configurable: priority window hours, weekdays-only toggle, timezone
- Async Telegram notification (send message to owner via bot)
Secrets: TELEGRAM_BOT_TOKEN, TELEGRAM_OWNER_CHAT_ID
3. Edge Function #2 — Post-Call Webhook
Called by ElevenLabs at call end. Writes to call_log.
Input: { call_sid, caller_number, started_at, duration_seconds, category, priority, outcome, ticket_id, consent_given, transcript } Output: { success, row_id }
Privacy rule: transcript is stored ONLY if consent_given === true. Otherwise NULL.
Secrets: SUPABASE_URL and SUPABASE_SERVICE_ROLE_KEY (auto-injected by Supabase runtime)
4. Telegram Notification
Personalization webhook sends a message to the owner's Telegram:
🔴 Eingehender AnrufZeit: 12.08.2026, 15:59Anrufer: +49123456789Angerufen: +4930123456Call SID: abc-123Status: Außerhalb der Geschäftszeiten
5. ElevenLabs Agent Config
Configure the Agent in ElevenLabs Dashboard:
- Personalization webhook URL:
https://<project>.supabase.co/functions/v1/personalization-webhook - Post-call webhook URL:
https://<project>.supabase.co/functions/v1/post-call-webhook - Tools:
transfer_to_owner,create_support_ticket,check_ticket_status
6. AI Disclosure Sentence (EU AI Act Art. 50)
Must be the agent's opening line. Required by EU AI Act Art. 50 before any functional interaction.
German:
„Hallo, hier ist der AI Support Agent von [Name]. Ich bin ein KI-Assistent und dieses Gespräch kann aufgezeichnet werden. Wie kann ich Ihnen helfen?"
English:
"Hello, this is the AI support agent from [Name]. This is an AI assistant and this call may be recorded. How can I help you?"
Deployment
Supabase CLI
# Installnpm install -g supabase# Login with PATsupabase login --token sbp_<your-pat># Link projectsupabase link --project-ref <project-ref># Deploy SQL (RPC functions)# Use Management API or SQL Editorcurl -X POST "https://api.supabase.com/v1/projects/<ref>/database/query" \-H "Authorization: Bearer <PAT>" \-H "Content-Type: application/json" \-d '{"query": "CREATE OR REPLACE FUNCTION ..."}'# Deploy functionsmkdir -p supabase/functions/<name>cp index.ts supabase/functions/<name>/supabase functions deploy <name> --project-ref <ref># Disable JWT verification (for webhooks called by ElevenLabs)curl -X PATCH "https://api.supabase.com/v1/projects/<ref>/functions/<slug>" \-H "Authorization: Bearer <PAT>" \-H "Content-Type: application/json" \-d '{"verify_jwt": false}'# Set secretssupabase secrets set KEY=VALUE --project-ref <ref>
Supabase Secrets (auto-injected)
SUPABASE_URL— project URLSUPABASE_SERVICE_ROLE_KEY— service role key
Custom Secrets (set manually)
TELEGRAM_BOT_TOKEN— for Telegram notificationsTELEGRAM_OWNER_CHAT_ID— owner's Telegram user ID
Hermes Profile Setup
Create a separate Hermes profile for the voice agent:
hermes profile create <name># Creates: ~/.hermes/profiles/<name>/# Creates: ~/.local/bin/<name> wrapper script# Copy configcp /opt/<name>/config.yaml ~/.hermes/profiles/<name>/cp /opt/<name>/.env ~/.hermes/profiles/<name>/# Set up gateway<name> gateway install<name> gateway start
The profile has its own Telegram bot, config, and sessions — fully isolated from the main Hermes instance.
Weekly Backup
Use systemd user timer for code/config backup (no PII, no call logs in git):
# Service unitcp hermes-2-backup.service ~/.config/systemd/user/# Timer unit — Sun 14:00 Europe/Berlincp hermes-2-backup.timer ~/.config/systemd/user/systemctl --user daemon-reloadsystemctl --user enable hermes-2-backup.timersystemctl --user start hermes-2-backup.timer
Priority Window Pattern
Pure clock logic — no LLM calls:
const windows = [{ start: 11, end: 12 }, // 11:00–12:00{ start: 13.5, end: 16 }, // 13:30–16:00];const WEEKDAYS_ONLY = true; // Mo–Frconst TIMEZONE = "Europe/Berlin";
Referenced Files
references/elevenlabs-webhooks.md— webhook payload schemasreferences/supabase-edge-functions-setup.md— deploying Edge Functionsreferences/eu-ai-act-disclosure.md— AI disclosure requirements
Pitfalls
- JWT verification: Edge Functions default to
verify_jwt: true. Disable it explicitly for webhooks called by external services - SUPABASE_ prefix:
SUPABASE_URLandSUPABASE_SERVICE_ROLE_KEYare auto-injected by Supabase runtime. Do NOT set them manually viasupabase secrets set— they will be rejected - Transcript privacy: Never store transcripts without explicit spoken consent (EU GDPR + AI Act). Default to
NULL - Call dedup: Post-call webhook may fire multiple times (retries). Use
ON CONFLICT (call_sid) DO UPDATEin the RPC - Edge Function deployment path: The CLI requires
supabase/functions/<name>/index.tsrelative to workdir. Asupabase/subdirectory is created bysupabase link - Time zone:
Intl.DateTimeFormatwithtimeZone: "Europe/Berlin"respects DST (CEST/CET) automatically