Everything runs on your own computer. Allow about an hour the first time, most of it in Google Cloud.
You need: Docker Desktop, a Google account, Telegram on your phone, and Python 3.10+ (only for the test script).
cp .env.example .envIn .env, set N8N_ENCRYPTION_KEY to a long random string and GENERIC_TIMEZONE to your clinic's timezone (for example Asia/Manila). Generate a key with either:
openssl rand -hex 32$b = New-Object byte[] 32; [Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($b); -join ($b | ForEach-Object { $_.ToString('x2') })Don't change the key later: n8n uses it to encrypt your saved logins.
docker compose up -dOpen http://localhost:5678 and create the owner account.
Create a spreadsheet, rename its tab to Enquiries, paste the line from templates/sheet-columns.csv into A1, and use Data → Split text to columns. The headers should fill A1 to P1.
-
Create a project.
-
APIs & Services → Library: enable the Google Sheets API, Google Drive API and Gmail API.
-
Google Auth Platform → Get started: choose External, then under Audience add your own Gmail as a test user.
-
Clients → Create client → Web application, with this authorized redirect URI:
http://localhost:5678/rest/oauth2-credential/callback -
Keep the Client ID and Client secret somewhere private.
While the app is in Testing mode, Google may ask you to reconnect about once a week.
Create these under Create → Credential. The workflow expects these names:
| Name | Type | What you need |
|---|---|---|
Google Sheets - LeadFlow |
Google Sheets OAuth2 API | Client ID and secret from step 3 |
Gmail - LeadFlow |
Gmail OAuth2 API | The same Client ID and secret |
Google Gemini - LeadFlow |
Google Gemini(PaLM) API | A key from https://aistudio.google.com/apikey |
Telegram - LeadFlow |
Telegram API | A bot token from @BotFather (/newbot) |
When Google says it "hasn't verified this app", choose Advanced → Go to (your app): it's your own app.
Send your bot any message, then open this in a browser, with your token in place of <TOKEN>:
https://api.telegram.org/bot<TOKEN>/getUpdates
The number after "chat":{"id": is your chat ID.
- Import
workflows/leadflow-enquiry-triage.jsoninto n8n. - Set Config: replace
YOUR_TELEGRAM_CHAT_IDwith your chat ID. Adjust the clinic name and office hours if you like. - Append to Sheet and Record Delivery Status: pick your spreadsheet and the
Enquiriestab (this replacesYOUR_GOOGLE_SHEET_ID). - Open each node that needs a login and select the matching credential: Gemini Primary, Gemini Backup, both Sheets nodes, Send Staff Alert, Send Acknowledgement.
- Save and Publish.
Open http://localhost:5678/form/brightside-enquiry and send an enquiry. To run the full test set:
python scripts/run_samples.py send you@gmail.com
python scripts/run_samples.py check "path/to/downloaded-sheet.csv"| Problem | Cause and fix |
|---|---|
| "Service unavailable" in an AI step | Google's model is busy (HTTP 503). Retries usually cover it; if it keeps happening, pick another model with free quota at https://aistudio.google.com/rate-limit |
| "The resource you are requesting could not be found" | The model is closed to new users (HTTP 404). Pick another model |
| The n8n screen only shows a vague AI error | Run docker logs leadflow-n8n to see Google's full message |
| Scripts get HTTP 401 from the form | The form's Ignore Bots option. The test script sends a browser-style user agent |
| A Google node suddenly asks you to sign in again | Testing-mode tokens expire after about 7 days. Reconnect the credential |
| Changes don't reach the live form | Click Publish again after saving |
After changing the workflow in n8n: Export JSON, keep the download outside the repo, then run:
python scripts/sanitize_workflow.py "path/to/downloaded-workflow.json"It swaps private values for placeholders and refuses to save if anything private remains.