See llms.txt for all machine-readable content.

Back to Templates

Process Australian GP referrals to Cliniko with Gmail, forms and OpenRouter

Quick overview

This workflow ingests Australian GP referrals from Gmail (email/e-fax PDFs) or an n8n upload form, uses OpenRouter to extract patient details into structured JSON, validates Medicare and GP provider numbers with checksum rules, and then either creates the patient in Cliniko or alerts reception in Slack for manual review.

How it works

  1. Triggers when a new Gmail message arrives with a PDF attachment and/or when a user submits the protected n8n upload form with a referral PDF or pasted text.
  2. Sends the referral content to an OpenRouter-powered AI agent to extract required patient and referral fields as strict JSON.
  3. Uses a structured output schema (with an OpenRouter “JSON fixer” model if needed) to ensure the extracted data matches the expected format.
  4. Validates referral dates and verifies Services Australia Medicare numbers and GP provider numbers using checksum rules.
  5. If validation passes, creates a new patient in Cliniko via the Cliniko API.
  6. If validation fails, posts a Slack message to the configured review channel showing only patient initials and the failed checks.

Setup

  1. Connect a Gmail account for the Gmail trigger (or disable it if you only use the upload form) and ensure referrals arrive as PDF attachments.
  2. Configure Basic Auth for the n8n form and share the form URL with staff who will upload referrals.
  3. Add an OpenRouter API credential and confirm the extraction and fixer models in the workflow configuration.
  4. Add Cliniko HTTP Basic Auth credentials (API key as username, blank password), set the correct Cliniko AU API base URL, and update the User-Agent string.
  5. Add a Slack credential, invite the bot to your review channel, and set the target channel name in the workflow configuration.

Requirements

  • OpenRouter API key (Zero Data Retention enabled on both model nodes)
  • Cliniko API key (Australian shard au1-au4) and Slack Bot token (chat:write)
  • Gmail account (optional if using only the built-in Upload Referral Form)

Customization

  • Change openrouter_frontier_model or openrouter_fixer_model in Workflow Configuration to any OpenRouter model
  • Swap Email & e-Fax Inbox (Gmail) for Microsoft Outlook or IMAP Trigger for Microsoft 365 / e-Fax-to-email inboxes
  • Add a GET /v1/patients lookup before Cliniko · Create Patient to deduplicate repeat referrals

Additional info

Tested on n8n 2.48.7. Runs Services Australia Medicare (mod 10) and GP Provider (PLV mod 11) checksums before writing to Cliniko; failed referrals alert Slack with patient initials only.