Introduction
SENTi-radar’s edge functions are serverless Deno-based endpoints deployed on Supabase that power the entire sentiment analysis workflow. These functions handle data collection from multiple social platforms, AI-powered sentiment analysis, insight generation, and automated monitoring.Architecture
The edge functions follow an orchestrator pattern:- analyze-topic - Main orchestrator that coordinates all other functions
- Data Collection - Platform-specific scrapers (Twitter/X, Reddit, YouTube)
- Analysis - Gemini-powered sentiment and emotion detection
- Insights - AI-generated reports and recommendations
- Monitoring - Scheduled scans and crisis alerts
Function Catalog
analyze-topic
Orchestrator function that creates topics and coordinates data fetching and analysis
fetch-twitter
Scrapes X/Twitter posts via Scrape.do with YouTube and Parallel.ai fallbacks
fetch-reddit
Extracts Reddit discussions and comments using web scraping
fetch-youtube
Fetches YouTube video comments using official Google API
analyze-sentiment
AI-powered sentiment and emotion classification using Gemini 1.5 Flash
generate-insights
Generates strategic recommendations and analysis reports with Gemini 2.0 Flash
scheduled-monitor
Automated background monitoring and crisis alerting system
Authentication
All edge functions require Supabase authentication:Most functions are designed to be called internally by the orchestrator using the service role key. Only
analyze-topic and generate-insights are typically called directly from client applications.Environment Variables
Your Supabase project URL (auto-injected)
Service role key for database access (auto-injected)
API token for Scrape.do web scraping service (required for X/Twitter and Reddit)
Google YouTube Data API v3 key (required for YouTube comments)
Google Gemini API key for AI analysis and insights (required for sentiment analysis)
Parallel AI API key for web search fallback (optional)
CORS Configuration
All functions include CORS headers allowing cross-origin requests:Error Handling
All functions return consistent error formats:Error Response
Rate Limits
Next Steps
Quick Start
Get started with your first sentiment analysis
Analyze Topic
Main orchestration endpoint
Fetch Twitter
X/Twitter data collection
Analyze Sentiment
AI sentiment analysis