Quick overview
This workflow monitors a Gmail inbox, uses Groq LLM classification to label each support email as urgent, routine, or spam, logs the result to Supabase, sends immediate WhatsApp alerts for urgent messages, and delivers a daily WhatsApp digest summarizing routine emails.
How it works
- Triggers every minute when a new email arrives in Gmail.
- Uses Groq (via an LLM prompt) to classify the email as urgent, routine, or spam and generate a one-sentence summary and reason.
- Inserts the email metadata, category, and summary into a Supabase table for tracking.
- Sends an immediate WhatsApp message to the support owner when the email is classified as urgent and updates the Supabase record to reflect it was notified.
- Runs on a daily schedule to fetch all routine emails in Supabase that have not yet been included in a digest.
- Aggregates those routine emails into a single WhatsApp digest message, sends it to the support owner, and marks the included Supabase records as digested.
Setup
- Connect Gmail OAuth2 credentials and ensure the trigger watches the support inbox/labels you want monitored.
- Add Groq API credentials for the chat model used to classify and summarize emails.
- Add Supabase credentials and create a table (for example,
support_emails) with fields for subject, sender, category, summary, digest_sent (boolean), and created_at.
- Add WhatsApp Business Cloud API credentials and fill in your WhatsApp phone number ID and the owner’s recipient number in both WhatsApp send steps.
- Update the Supabase table name and adjust the daily schedule time (hour) to match when you want the routine digest sent.