Line Chatbot Pay Slip Data Extractor using Gemini and Google Sheets - n8n Workflow

Automate pay slip data extraction from Line images using an n8n workflow leveraging Google Gemini vision capabilities. Log results instantly to Google Sheets.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Users managing financial or expense reports submitted via chat applications like Line.

  • Individuals seeking advanced AI-driven n8n templates for multimodal processing (text and vision).

  • Technical teams needing a reliable n8n node solution for real-time document data capture.

  • n8n specialists building highly integrated AI assistants and conversational interfaces.

Overview

This comprehensive n8n workflow addresses the challenge of manually extracting structured financial data from unstructured image submissions, such as pay slips or receipts, sent via the Line messaging application. By implementing a sophisticated AI structure, this n8n template automatically classifies the incoming message type (text or image) using the initial n8n trigger. If an image is detected, the workflow utilizes the multimodal power of Google Gemini to perform accurate data extraction (OCR) for fields like Status, Date, From, To, and Amount. The resulting data is then cleanly appended to a Google Sheet, ensuring efficient record-keeping. This robust n8n workflow offers dual functionality: a smart conversational agent for text messages and a specialized data extraction tool, showcasing the flexibility of the n8n node architecture.

How it Works

The entire automation begins with the Line: Messaging API n8n trigger, which listens for new messages. The subsequent Message Classification switch n8n node directs the flow based on the message type (text or image).

For Text Messages: The message flows to the Text Message Processing LangChain agent. This agent utilizes the Window Buffer Memory n8n node to maintain conversation context based on the user ID, ensuring continuity. The core logic is powered by the Google Gemini for Text model. The final response from the AI is returned to the user via the Line: Text Response to User HTTP Request n8n node.

For Image Messages (Pay Slips): The flow first uses the Line: Get Image HTTP Request n8n node to fetch the actual image binary content using the message ID. This binary data is then passed to the Image Message Processing LangChain LLM Chain n8n node, which connects to the Google Gemini for Image model. A specific instruction is provided, asking Gemini to analyze the pay slip image and return the extracted data strictly in a JSON format containing Status, From, To, Date, and Amount. The resulting JSON is extracted, replied to the user via the Line: Response to User n8n node, and finally, parsed and inserted into a Google Sheet using the Text from Slip Result n8n node, completing this powerful n8n workflow.

Installation Guide


  1. Import the n8n workflow: Copy the provided JSON data and paste it directly into your n8n instance using the 'New' -> 'Import from JSON' function.

  2. Set up Credentials:

Line Messaging API: Configure the Line: Messaging API n8n trigger webhook path and connect it to your Line developer console.
HTTP Header Auth (Line API): You will need a generic HTTP Header Auth credential for sending replies and getting images from Line (used by 'Line: Get Image', 'Line: Response to User', and 'Line: Text Response to User'). This usually involves your Channel Access Token.
Google Gemini: Set up the Google Gemini (PaLM) API credential for the Google Gemini for Text and Google Gemini for Image n8n node configurations.
Google Sheets: Configure the OAuth2 credential for the Google Sheets n8n node and update the Document ID and Sheet Name parameters to point to your destination spreadsheet.

  1. Activate: Ensure the workflow is marked as 'Active' to enable the n8n trigger to start processing messages.

Node Details

Line: Messaging API (n8n trigger): The starting n8n node. It acts as a webhook to instantly receive incoming text or image messages from the Line chat platform.
Message Classification (Switch n8n node): A critical flow control element that checks the incoming message type (text or image) and routes the execution down the appropriate processing path.
Window Buffer Memory (n8n node): Used in the text path to store and manage the conversational history for each unique user session ID, enhancing the AI agent's responsiveness.
Google Gemini for Text/Image (n8n node): Specifies the models/gemini-2.0-flash-exp model, providing the underlying large language model capabilities for both conversation and vision tasks within this n8n workflow.
Text Message Processing (LangChain Agent n8n node): Handles conversational input, integrating memory and the Gemini LLM to generate relevant text responses.
Line: Get Image (HTTP Request n8n node): Executes a GET request to the Line data API to securely download the image binary content sent by the user, preparing it for AI analysis.
Image Message Processing (LangChain LLM Chain n8n node): Uses a specific, structured prompt combined with the image binary to instruct Gemini to extract financial fields (Status, From, To, Date, Amount) and return them as a JSON object, enabling structured data handling.
Text from Slip Result (Google Sheets n8n node): The final action in the image processing path. This n8n node parses the JSON output from Gemini and uses the 'Append' operation to insert the extracted pay slip data into the configured Google Sheet.

Related n8n Workflows

Free

Nodes: 10 Nodes
Updated: December 26 2025
View all
Created by

Automation consultant with 1 year experience helping Sales & Marketing teams to streamline their processes. Use my link to book an initial consultation for custom n8n work.

Featured*