Skip to content

Inbound Email to Task Automation #21

@macwilling

Description

@macwilling

Feature: Inbound Email to Task Automation

🎯 Objective

Allow clients to create tasks automatically by sending an email to a designated inbound address (e.g., tasks@yourdomain.com). The system should identify the client by their sender address and store any attachments in R2.

Below is suggested plan, but please evaluate based on current codebase and PLAN path forward before making code changes.

🛠️ Implementation Steps

1. Resend Configuration

  • Configure Inbound Mail in the Resend Dashboard.
  • Point the Webhook URL to something like https://yourdomain.com/api/webhooks/inbound.
  • Secure the endpoint using a RESEND_WEBHOOK_SECRET.

2. Webhook Logic (/api/webhooks/inbound)

  • Sender Verification: Extract the from address and query the Supabase clients table.
  • Content Parsing: Extract subject (Task Title) and text or html (Task Description).
  • Attachment Handling: - Loop through the attachments array provided by Resend.
    • Fetch the file from the Resend download_url.
    • Stream the buffer to Cloudflare R2 using the @aws-sdk/client-s3.
    • Store the R2 public URL (or key) in a task_attachments table in Supabase.

3. Database Schema Updates

  • Ensure tasks table has a client_id foreign key.
  • (Optional) Create task_attachments table:
    create table task_attachments (
      id uuid default uuid_generate_v4() primary key,
      task_id uuid references tasks(id),
      file_url text,
      file_name text
    );

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions