The AgentivUse cases

Operations · About a week · Thailand

Chinese and Thai teams chat in one LINE group

A LINE bot that sits in a group chat and translates every Chinese message into Thai and every Thai message into Chinese with Gemini, with the right Thai politeness particles for the speaker, published as open source by a Bangkok digital signage company

LINEGeminiAlso works withClaudeOpenAI

The problem

Many Thai businesses buy from or work with Chinese speaking partners, and the day to day coordination happens in LINE groups where one side writes Chinese and the other Thai. Someone bilingual becomes the bottleneck, copy pasting into a translation app, and Thai replies that drop the polite ending or use the wrong one read as curt to a customer or a boss.

Architecture

  1. Channel
    • LINE group chat
    • Official account bot
  2. Agent
    • Flask webhook server
    • Gemini translates
  3. Tools
    • Politeness rules in the prompt
    • Speaker gender in SQLite
  4. Human
    • Bilingual colleague checks
    • Members set their gender

Where the data stays: Group messages pass through your own server to the model provider; keys stay in a local .env file and genders in a local SQLite file.

Design flow

  1. Member writes in Chinese or Thai
  2. Server checks the LINE signature
  3. Commands, links or plain English: ignoredOnly sometimes
  4. Gemini translates with the politeness rules
  5. Translation posted in the group with a flag
  6. Bilingual colleague checks and correctsHuman checkpoint

Setup

Total time: 2 h 50 min our estimate

  1. 20 min

    Done when: In LINE Official Account Manager the bot may join group chats, the response mode is Bot and auto reply messages are off.

  2. 15 min

    Done when: The LINE channel access token, channel secret and the Gemini key from Google AI Studio are in .env with owner only rights, and git status shows .env is not tracked.

  3. 1 h

    Done when: The server runs as a service, the webhook URL ends in /line/callback, and Verify in the LINE Developers Console succeeds.

  4. 15 min

    Done when: The config check passes with GEMINI_MODEL and GEMINI_FALLBACK_MODEL set, and a test message is translated.

  5. 30 min

    Done when: The test sentence 非常感谢,我现在通知工厂 comes back with ครับ and ผม for a male speaker, ค่ะ for a female speaker, and never a slash pair like ครับ/ค่ะ.

  6. 30 min

    Done when: The bot is in one supplier or customer group, members were told and asked to set their gender with the command, and the bilingual colleague logs each correction for two weeks.

Ticks are saved on this browser.

Download the kit (zip)

Starter prompt

Written from how the use case works and its sources. Replace the parts in square brackets.

You translate messages in a LINE group between Simplified Chinese and Thai. If the message is Chinese, translate it into natural Thai; if it is Thai, translate it into natural Simplified Chinese. Keep product names, part numbers, amounts, dates and links exactly as written. Thai politeness: the speaker is [male, female or unknown]; for a man end sentences with the male polite particle (khrap) and use the male first person pronoun (phom), for a woman use the female polite particle (kha) for statements and its question form for questions, with the formal female first person pronoun (dichan), and for an unknown speaker use neutral business wording with the male polite particle and no first person pronoun. Never write both forms with a slash. Return only the translation, with no explanation. Message: [paste the message]

Risks and data

Data

Every message in the group goes to the model provider, and the automatic guess reads nicknames and profile pictures, which is profiling of personal data. Tell the members, keep the bot out of groups that discuss personal or contract data, prefer the gender command over the guess, and keep the LINE token and model key in the local .env file.

How it goes wrong

A wrong polite ending reads as curt, or a part number or amount is changed in translation and the other side acts on it. Keep product names and numbers untranslated in the prompt, let the bilingual colleague count corrections for two weeks before adding groups, and if a key leaks, regenerate it in the LINE Developers Console or with the model provider and restart the bot.

Data protection. This use case touches personal data, so check the rules where you operate (for example GDPR, PDPA). The bot reads every message in the group and sends it to a model provider, so tell the members and keep it out of groups where personal or contract data is discussed unless your provider terms cover it. Inferring a member's gender from their nickname and profile picture is profiling of personal data; the safer setting for a business group is to ask members to set it with the command and switch the automatic guess off. Keep the LINE token and the model key in the local .env file as the source does, and rotate them if they ever leak.

How the agent works

  1. It starts

    The bot is added to the LINE group as an official account with group joining allowed, the default auto reply switched off and a webhook pointing at a small Flask server.

  2. The agent works

    Every text message in the group reaches the server through the LINE Messaging API; it checks the LINE signature, then decides whether the message needs translating at all. Messages with Chinese or Thai characters are translated, while commands, plain English or numbers and bare links are ignored so the group is not spammed. The message goes to Gemini with politeness rules added to the prompt: a male speaker gets ครับ and ผม, a female speaker ค่ะ or คะ and ดิฉัน, an unknown speaker neutral business wording. The speaker's gender comes from a command they can send once (for example 我是男生 or ผมเป็นผู้ชาย), and if they never set it the bot asks Gemini to infer it from the LINE nickname and profile picture, only at 75 percent confidence or more, and keeps the result in a local SQLite file. The translation is posted back into the group with a Thai or Chinese flag, so both sides keep reading one chat.

  3. The result

    env file that is never committed.

Worked example

MACC Electronics (Thailand) Co., Ltd., a Bangkok company that sells digital signage, kiosks, LED screens and smart displays to businesses in Thailand, publishes the bot as the open source repository macc-line-translate-bot on its GitHub account, with a Chinese and a Thai README. The README documents the flow from LINE webhook to Gemini 3.8 Flash and back, the fallback model gemini-3.1-flash-lite, the gender commands, the three LINE Official Account Manager settings a group deployment needs, the systemd service it runs as, and an automated test suite for the politeness rules; one of its test sentences is a Chinese message that says thank you, I am notifying the factory now. The repository does not say which groups the company runs it in or give any volumes, so measure your own: messages translated per day and corrections the bilingual colleague still has to make.

The translation is one text model call with the politeness rules in the prompt, so Claude or an OpenAI model can take Gemini's place; the gender guess from a profile picture needs a model that reads images, which all three offer. The LINE part is fixed: the official account settings (allow group chats, auto reply off, webhook on) and the Messaging API are what put the bot in the group.

Join the Agent OS Club

Get hours back with a team of AI agents for every department, set up step by step for the tools you use, with a person answering your questions. Founding member price: USD 14.95 a month or USD 150 a year, locked for as long as you stay. Cancel any time.

Founding offer, ends 31 December 2026 or at member 100

Join the Agent OS Club

Building this for an organization? Learn more at theagentiv.com

Sources

Published: 2026-11-04

Related use cases

Part numbers for 1,000 products, one afternoon

ChatGPT builds the part numbering system for an 86 year old salvage yard's more than 1,000 products in one afternoon, exports it to Excel as part number and category ID per row, and answers specification and material questions while the customer waits at the counter

OperationsEffort: An afternoon
ChatGPTExcelAlso works with:ClaudeGemini

A yard, a workshop or a shop that grew over decades has more than a thousand items that everyone knows by sight and nobody can find on paper. A proper numbering system has been on the list for years and keeps being postponed, because it looks like weeks of work, so quotes, stock counts and reorders all run on memory.

Every crop since 1971, searchable

ChatGPT as the farm's field notebook: a handwritten crop ledger kept since 1971 digitized and made searchable, loads logged by voice from the combine, a stressed plant diagnosed from a photo, and the owner confirming anything that matters with her father

OperationsEffort: An afternoon
ChatGPTAlso works with:Claude

In a family business the operating record lives in the founder's handwriting: a ledger of every crop, field and season, and a lifetime of judgment about what went wrong and why. The next generation taking over cannot search it, and the day to day log of loads, repairs and water use is kept on scraps or not at all, because hands are on a steering wheel.

Your whole day in one morning report

A ChatGPT report template employees run first thing in the morning that pulls their day from Gmail, Google Calendar, Sheets, Drive, Asana, Slack and QuickBooks

OperationsEffort: An afternoon
ChatGPTGmailGoogle Calendar+3Also works with:Claude

A small team starts every day by opening the inbox, the calendar, the task board, Slack and the accounting app, and stitching the picture together by hand. The gathering takes the first hour, the picture is never complete, and the thing that mattered most is often in the one tool nobody opened.