Turn flagged Gmail into Google Tasks every morning

By General Input

Every weekday at 7am, an agent reads the emails you flagged with a todo label or star, then files a clear next action into Google Tasks.

Integrations

  • Gmail
  • Google Tasks

Type

Agentic Task

Categories

  • Personal Productivity
  • Operations

Every weekday at 7am in my local time zone (cron trigger), run an agent that turns flagged emails into Google Tasks. Process one email at a time and finish the full loop on each one before moving to the next.

Step 1. Find candidate emails. Use Gmail's List Messages with a search query that matches messages I labeled "todo" OR starred in the last 24 hours, and only those still in the inbox. A query like (label:todo OR is:starred) newer_than:1d in:inbox works. Cap the batch at 25 messages per run.

Step 2. For each message id, call Gmail's Get a Message with format=full to read sender, recipients (To and Cc), subject, date, and the plain-text body. Skip the email entirely if any of these are true: it is an automated newsletter or marketing email (List-Unsubscribe header present, or sender domain is a known bulk sender), it is a calendar invite (Content-Type includes text/calendar or subject starts with "Invitation:"), or I am only on Cc with no question or request directed at me. When you skip, do not modify labels and do not create a task.

Step 3. For each email you do not skip, decide three things by reading the email: the concrete next action I need to take, the person I owe a reply or follow-up to, and the urgency. Urgency comes from explicit dates in the email, urgent language from the sender, and the sender's importance (known client or executive vs. internal teammate). Write a short imperative task title, for example "Reply to Priya re Q3 renewal terms" or "Send updated SOW to Acme by Friday".

Step 4. Pick a due date. If the email mentions a specific deadline ("by Friday", "end of week", "before our 6/20 call"), use that date. Otherwise default to two business days from today, skipping weekends.

Step 5. Create the task with Google Tasks Create Task on the list named "Inbox actions". Set the title to the imperative title from step 3, the due date from step 4, and the notes field to a short block with: From: <sender name and email>, Subject: <original subject>, Summary: <two-sentence summary of what the email is asking for>, Link: <Gmail thread permalink in the form https://mail.google.com/mail/u/0/#inbox/<threadId>>.

Step 6. After the task is successfully created, call Gmail Modify Message Labels on the same message id to remove the "todo" label and add a "queued" label. This is the idempotency mechanism so the next morning's run will not pick the same email up again. If the "queued" label does not exist yet, create it once at the start of the run.

If any step fails for a given email (rate limit, missing list, parse error), log the message id and the error and move to the next email. Do not partially-apply labels: only swap the labels after the task is confirmed created.

At the end of the run, the agent does not need to notify me. The output I care about is the new tasks sitting in my "Inbox actions" list when I open Google Tasks at 7am.

Related prompts

Explore more prompts
Win back LiveChat visitors whose chats went unansweredChase the paperwork every new client and vendor still owesFile Gmail attachments into storage with names you can findCandidate rediscovery desk for your archived Lever applicantsLaytime and demurrage claim workspace for chartering opsKajabi customer support console for member access fixesRun your application review round on Jotform submissionsRun your nutrition clients' weekly meal plans from one consoleReplace the dispatch whiteboard with a live production boardJob search command center with a self-filling pipeline board