📊 Track Japanese law amendments with the e-Gov Law API, Claude and Google Sheets

⚡ 1 views · 📊 Market Research & Insights

Description

Quick overview

This workflow checks selected Japanese laws daily via the e-Gov Law API, compares the latest revision to the last watched revision, uses Anthropic Claude to explain article-level changes, logs results to Google Sheets, and posts a per-law summary to Slack.

How it works

  1. Runs every day on a schedule (or manually in demo mode to compare the two newest revisions).
  2. Reads the current watch state from a Google Sheets “Watch” tab and builds a per-law list from the configured law IDs.
  3. Calls the e-Gov Law API to fetch each law’s revision list and determines whether to baseline (first run), compare revisions (new change), or report an invalid law ID.
  4. For laws with a new revision, fetches the old and new law texts from the e-Gov Law API and computes an article-by-article diff (including supplementary provisions).
  5. Sends the changed-article excerpts to Anthropic Claude to generate a JSON explanation with verbatim before/after quotes, then validates the output against the diff (keys, quotes, and numbers) and formats a Slack-ready summary.
  6. Writes detailed change rows to a Google Sheets “Changes” tab, posts one summary message per law to Slack, and updates the “Watch” tab with the newest revision so the next run compares from that point.

Setup

  1. Create a Google Sheets spreadsheet, paste its ID in the workflow’s Spreadsheet ID value, then run the “set up the sheet” branch once to create the “Watch” and “Changes” tabs and headers.
  2. Add Google Sheets OAuth2 credentials and select the target spreadsheet in the Google Sheets nodes that read/write the Watch and Changes tabs.
  3. Add an Anthropic credential for the Claude node.
  4. Add a Slack credential, choose the target channel, and update the channel selection in the Slack message node.
  5. Update the Config values for watched_laws (e-Gov law IDs), output_language, and the max_articles/max_chars limits to control how much text is sent for explanation.

Requirements

Customization

Additional info

What the checks cannot catch:

What I tested: the real e-Gov API on 3 laws (Labor Standards Act, Personal Information Protection Act, Subcontract Act): the demo, the first run (record), a run with an older remembered version (the amendment was found, logged and sent; the Watch tab was updated), a second run (nothing happens), and a wrong law ID (reported in Slack). Plus 30 unit checks of the code. One run each; that is not a measure of accuracy.

đź”— Nodes Used

Google Sheets, HTTP Request, Slack, Schedule Trigger, Anthropic

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup