Quick overview
This workflow receives LINE messages, uses Google Gemini to extract veterinary booking details, stores and tracks requests in Google Sheets, requests clinic approval via Gmail, and then checks Google Calendar to create and confirm appointments while notifying the owner on LINE and alerting an admin on failures.
How it works
- Receives a POST webhook from LINE, computes an HMAC signature, and stops if the signature does not match the X-Line-Signature header.
- Splits the webhook into individual LINE events, filters to 1:1 text messages, detects emergency keywords, and replies on LINE with either receipt confirmation or “call the clinic” guidance.
- Checks and writes an EventLog entry in Google Sheets to deduplicate events and route booking messages into intake processing.
- For booking intake, looks up any active request in the BookingRequests sheet, then uses Google Gemini to extract booking details, validates the extraction against the owner’s message evidence, and saves or updates the request in Google Sheets.
- Sends a LINE push to the owner to ask for missing fields, confirm the request is pending clinic approval, or indicate the request is waiting, and updates the EventLog result accordingly.
- When a request is ready for approval, emails the clinic via Gmail with Approve/Decline actions, waits for a response until the configured expiry time, and writes the decision back to Google Sheets.
- After approval, checks Google Calendar free/busy for the requested slot, creates a deterministic calendar event if available, marks the booking CONFIRMED in Google Sheets, and sends a confirmation message to the owner on LINE.
- When any step requires manual review, sends a structured alert email via Gmail to the admin email address with the failure stage and identifiers.
Setup
- Create a LINE Messaging API channel and configure its webhook URL to point to this workflow’s production webhook endpoint.
- Add credentials for LINE (Channel Secret for HMAC and a Channel Access Token via HTTP Header Auth), Google Sheets OAuth2, Google Calendar OAuth2, Gmail OAuth2, and a Google Gemini (PaLM) API credential.
- Create a Google Sheets spreadsheet with two tabs and put these exact column names in row 1. EventLog: webhookEventId, bookingId, receivedAt, processedAt, result. BookingRequests: bookingId, lineUserId, status, petName, petType, visitType, symptoms, preferredStart, preferredEnd, missingFields, sourceText, intakeTurnCount, collectingExpiresAt, approvalExpiresAt, decision, decidedAt, calendarEventId, calendarCreateAttemptedAt, confirmedAt, notifyStatus, failureStage, lastError, createdAt, updatedAt.
- Update the Workflow configuration values (spreadsheetId, calendarId, clinicTimezone, clinicPhone, clinicApprovalEmail, adminAlertEmail, reception hours, slotMinutes, and timeouts) before activating the workflow.
- Check the credential on all 42 nodes that use one, including auto-selected ones. On import, n8n may pick a different Crypto credential for Compute LINE signature; it must hold your LINE channel secret, or every message is quietly dropped.
- Use a webhook path no other workflow uses, publish, and test once with a dedicated spreadsheet, calendar and approval inbox before live use.
Requirements
- LINE Official Account with a Messaging API channel (channel secret and channel access token)
- Google Gemini API key
- Google Sheets, Gmail and Google Calendar accounts
- n8n reachable on a public HTTPS URL, for the LINE webhook and the Gmail approval links
Customization
- Edit the reply texts, reception hours, slotMinutes and emergencyKeywords in the Workflow configuration node
- Change approvalTimeoutMinutes to give the clinic more or less time to approve
Additional info
No booking changes, cancellations or automatic data deletion. Google Sheets cannot fully prevent conflicts from concurrent requests. Sheet writes, Calendar creation and LINE messages are not retried automatically, and uncertain cases go to manual review. Don't re-run failed executions from the history, because it can send the owner a second LINE message.