Send re-engagement emails to inactive users with Supabase, Claude and SMTP
Quick Overview This workflow runs daily to find inactive users in Supabase, generates personalized re-engagement emails with Anthropic Claude using brand directions stored in an emailguidance table, sends the emails v...
Template notes
Quick Overview This workflow runs daily to find inactive users in Supabase, generates personalized re-engagement emails with Anthropic Claude using brand directions stored in an emailguidance table, sends the emails via SMTP, and updates the user record to prevent repeat sends.
How it works 1. Runs every day at 9am on a schedule. 2. Reads the selected email guidance (three directions and a subject hint) from the Supabase emailguidance table based on the configured mail type. 3. Fetches up to 100 users from the Supabase users table who have been inactive longer than the configured number of days and have not been sent a re-engagement email. 4. Sends each user’s name and the three guidance directions to Anthropic Claude to generate a JSON response containing an email subject and body. 5. Parses Claude’s response, builds an HTML version of the email, and skips any users without an email address. 6. Sends the email via SMTP and, on successful delivery, updates the Supabase user record to set reengagementsent to true and store the reengagedat timestamp.
Setup 1. Add Supabase credentials (host and servicerole key) and ensure your database has a users table plus an emailguidance table with fields for mailtype, direction1, direction2, direction3, and subjecthint. 2. Add an Anthropic (Claude) API key using HTTP Header Auth with the x-api-key header, and keep the required Anthropic version header as configured. 3. Add SMTP credentials for your email provider and set the fromEmail value in the workflow configuration. 4. Update the workflow configuration values (inactiveDays, mailType, and model) and confirm your users table includes email, name, lastactiveat, reengagementsent (and optionally reengagedat) columns.