This is my personal LINE bot that helps me automate various tasks of everyday life, such as home control (air conditioner, lights and plugs) and expense tracking (record how much I spend each day). See below for a feature tour.
I recommend every developer to try creating their own personal assistant chat bot. It’s a great way to practice coding and improve problem solving skills. And it helps make life more convenient!
It is written in TypeScript and runs Google App Engine Node.js Standard Environment.
I have a Raspberry Pi set up which can control lights, air conditioner, and smart plugs. It receives commands via CloudMQTT and performs the action, then reports back to automatron via its API.
Simple expense tracking by typing in the amount + category. Example: 50f means ฿50 for food. Data is saved in Airtable.
On mobile, tapping the bubble’s body (containing the amount) will take me to the created Airtable record. This allows me to easily edit or add remarks to the record. Tapping the bubble’s footer (containing the stats) will take me to Airtable view, which lets me see all the recorded data.
I set up IFTTT to read SMS messages and send it to automatron. It then uses transaction-parser-th to parse SMS message and extract transaction information. It is then sent to me as a flex message.
In mobile phone, quick reply buttons lets me quickly turn a transaction into an expense record by simply tapping on the category.
Certain kinds of transactions can be automatically be turned into an expense, for example, when I take BTS Skytrain using Rabbit LINE Pay card. Having many features in one bot enabled this kind of tight integrations.
automatron can also convert image to text using Google Cloud Vision API.
LiveScript interpreter is included, which allows me to do some quick calculations.
POST /text
sends a text command to automatron. This is equivalent to sending a text message through LINE. This allows me to create a CLI tool that lets me talk to automatron from my terminal.
POST /post
sends a message to my LINE account directly. This allows the home automation scripts to report back to me whenever the script is invoked.
The secret data required to run the automation are defined in BotSecrets.ts.