Automate Pay Slip Text Extraction with Line & Google Gemini

This workflow automates extracting key pay slip details sent as images via Line chat, using Google Gemini AI for image analysis, and logs results to Google Sheets, saving hours of manual data entry and reducing errors.
lmChatGoogleGemini
httpRequest
googleSheets
+7
Workflow Identifier: 1690
NODES in Use: memoryBufferWindow, stickyNote, httpRequest, set, switch, agent, chainLlm, googleSheets, webhook, lmChatGoogleGemini

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What this workflow does

This workflow listens to messages on Line chat and handles text and image inputs differently.
It pulls key data from pay slip images and chats, then saves info to Google Sheets.
It helps HR reduce manual work and errors in payroll extraction.

  • Gets message type from Line API webhook.
  • Uses Google Gemini AI to understand text or read pay slip images.
  • Replies to users with info or answers.
  • Saves extracted data to Google Sheets for records.


Who should use this workflow

This is for HR teams or payroll managers who get pay slips as images in Line group chats.
Anyone who needs to save time by automating text extraction from pay slips.

It fits companies using Line messaging, Google Sheets, and Google Gemini AI.
Users with basic n8n knowledge can deploy it easily.


Tools and services used

  • Line Messaging API: Receives and replies to user messages.
  • Google Gemini API: Analyzes chat texts and pay slip images.
  • Google Sheets API: Stores extracted pay slip data.
  • n8n Automation Platform: Runs the workflow.
  • HTTP Header Authentication: Secures Line API calls within n8n.


Beginner step-by-step: How to use this workflow in n8n production

Download and import workflow

  1. Download the workflow file using the Download button on this page.
  2. Inside the n8n editor, click “Import from File” and choose the downloaded workflow.

Configure credentials and settings

  1. Add or update your Line Messaging API credentials in n8n.
  2. Set the Google Gemini API Key in the LangChain nodes.
  3. Connect your Google Sheets account and update the spreadsheet URL and sheet name if needed.
  4. If needed, update any referenced IDs, tokens, or fields such as webhook path, or sheet columns.

Test and activate workflow

  1. Send a test message and/or pay slip image via Line chat to check if the workflow processes data.
  2. Review outputs and Google Sheets entries for correctness.
  3. Once confirmed, toggle the workflow to Active in n8n for production use.

For stable production use, consider hosting n8n on your own server. You can visit self-host n8n resources for help.


Inputs, Processing Steps, and Outputs

Inputs:

  • Messages (text or images) sent by employees in Line chat.
  • Authentication tokens and credentials for APIs.

Processing:

  1. Webhook node receives Line chat events.
  2. Set node extracts message type, text, user ID, and message ID.
  3. Switch node classifies message as text or image.
  4. If text, LangChain Conversational Agent with Google Gemini AI processes message context.
  5. If image, HTTP Request downloads pay slip from Line server using message ID.
  6. Google Gemini AI analyzes pay slip image to extract JSON fields: Status, From, To, Date, Amount.
  7. Responses sent back to user through Line Messaging API reply.
  8. Extracted pay slip data appended to Google Sheets for record keeping.

Outputs:

  • User receives replies with extracted info or chat answers.
  • Google Sheets document updated with pay slip data rows.


Customization ideas

  • Add new pay slip fields like “Employee ID” or “Department” in the LangChain prompt and Google Sheets mapping.
  • Change LangChain prompts to support multiple languages per employee base.
  • Add email notifications to alert payroll team after a new pay slip is saved.
  • Add file conversion if PDFs need to be processed by converting them to images first.
  • Adjust chat memory window size or timeout in Window Buffer Memory node for better session context.


Edge cases and errors

  • Cannot get image from Line API: Check URL and ensure stored Line API access token in n8n is valid.
  • Malformed JSON from AI: Fix LangChain prompt to clearly ask for JSON and add error handling.
  • User not getting replies: Verify replyToken from incoming Line events is used correctly and promptly.


Pre-deployment checklist

  • Confirm Line webhook receives and classifies both text and images properly.
  • Verify Google Gemini API key allows chat and image processing.
  • Ensure Google Sheets fields match exactly what AI outputs.
  • Check HTTP Header Auth credential for Line API is active.
  • Run full test: upload a pay slip image, confirm user reply, and check Google Sheets entry.


Deployment guide

Toggle the workflow Active switch in n8n to start handling live messages.
Monitor executions to catch any errors early.
This runs without keeping open servers, triggering on incoming events.
For heavier usage or uptime, consider self-host n8n.


Summary

✓ Saves 4-5 hours of manual pay slip data reading each pay cycle.
✓ Automatically extracts key payment info from chat images.
✓ Replies to employees with clear extracted details.
✓ Archives data reliably in Google Sheets.
✓ Easy to test, configure, and run within n8n.


Frequently Asked Questions

Yes, other AI models like OpenAI GPT can be used instead of Google Gemini, but changes in prompt and output formats might be needed.
Yes, all calls to Google Gemini API count toward your Google API quota depending on the number and size of requests.
Data is stored in the connected Google Sheets document and temporarily processed within n8n, which must be secured properly.
Yes, but scaling depends on n8n hosting capabilities and Google API rate limits; using self-host n8n can help handle larger loads.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free