See llms.txt for all machine-readable content.

Back to Templates

Draft payment reminder emails from freee Accounting with Claude and Gmail

Quick overview

This workflow runs every weekday morning, reads unsettled income deals and partner details from freee Accounting, uses Anthropic Claude to draft Japanese payment reminder emails for overdue amounts, saves passing reminders as Gmail drafts, and emails staff a report of created drafts and any issues.

How it works

  1. Runs every weekday at 9:00 (or manually) and loads configuration like the freee company ID, minimum overdue days, and staff notification email.
  2. Fetches unsettled income deals and the partner list from the freee Accounting API.
  3. Filters deals that are past due with an amount still due, groups them by customer, skips customers without an email address, and limits processing to the top customers by total overdue amount.
  4. Sends each customer’s invoice facts to Anthropic Claude to generate a polite Japanese reminder email as JSON with a subject and body.
  5. Validates the draft to ensure all invoice numbers, remaining amounts, and due dates match freee data and rejects drafts containing extra amounts, late-fee/legal language, or missing required facts.
  6. Creates a Gmail draft for each passing reminder (without sending) and emails staff a single Gmail message summarizing drafts saved, drafts rejected with reasons, and customers that could not be drafted.

Setup

  1. Create a freee app with read access to Deals and Partners, then add an n8n OAuth2 credential for the freee API and set your freee company ID.
  2. Add Anthropic credentials for Claude and a Gmail OAuth2 connection for creating drafts and sending the staff notification email.
  3. Update the Config values (staff_email, sender_signature, min_days_overdue, max_customers, and timezone) and optionally set today_override for testing before enabling the schedule.

Requirements

  • freee Accounting (freee会計) and an app in freee Developers (permissions: deals and partners, read); an n8n OAuth2 API credential for freee. Gmail (OAuth2) and an Anthropic API key (one Claude call per customer with overdue sales). Customer e-mail addresses in freee partners.

Customization

  • Set the company ID, staff e-mail, signature, days overdue before reminding and customers per run in Config (today_override for testing with past data). Change the tone in the Write the reminder prompt. Change the weekday schedule. Send the notice to Slack or Teams instead of Gmail.

Additional info

Nothing is sent: reminders are saved as Gmail drafts. Claude gets only the facts from freee; code checks every invoice number, remaining amount and due date in each draft, rejects any other amount and words like late fees or legal action, and lists stopped drafts in the staff notice. Tested on a freee developer test company with made-up deals, including a partly paid sale.