Help you record who is adding one in LINE group messaging
When a LINE group opened a group purchase or registered for a course, people went viral saying "+1". Manual recording was tiring. Use the "LINE Plus One Recording Robot" to automatically record the users who sent "+1" to the Google spreadsheet and return it to you! I put the complete setting tutorial on my personal website, click here to add a LIND BOT customized tutorial
2022 3/30 Update: Improve code execution performance and modularize duplicate codes for easier maintenance.
This is a LINE robot I designed for my mother’s yoga teacher. The teacher used to manually record the students who called “+1” in the group to make reservations for classes. Therefore, this robot was designed with “class reservation” as the starting point. You can also modify it to other functions.
This is a group screenshot of the course. As long as someone in the group sends a +1, the robot will automatically record it and send back a notification of successful registration and how many seats are left:
Pass the specified keyword "list" to let the robot send the complete registration list:
The data is temporarily stored in Google Spreadsheet, and there is no need to create a separate server or database:
Copy the contents of app.js and paste it into your Google App Script project
Fill in the quotes of CHANNEL_ACCESS_TOKEN with your LINE API Token:
var CHANNEL_ACCESS_TOKEN = " *** " ;
Enter your Google spreadsheet link within the quotation marks of sheet_url on line 18:
var sheet_url = ' https://docs.google.com/spreadsheets/... '
In addition to LINE Token and Google Sheet links, you can also customize some details or variable names of the program. I have listed some important variables in the table below:
variable name | use | Remark |
---|---|---|
userMessage | The content of the text message sent by the user | string format |
user_id | User ID string | Use the User Info API on line 50 to query the user name |
sheet_name | Google Sheet sheet name | Please enter the correct name. Otherwise you won’t be able to catch it |
reserve_list | All information on the worksheet | You can customize and modify it, but you need to use ctrl + F to modify all |
current_list_row | The maximum number of rows in the data table (the number of rows in the last data) | .getLastRow() syntax |
reply_message | The content of the message to be sent back to the user | JSON Format, please do not directly fill in the message text , please refer to LINE's official API document |
current_hour | Determine the time when the user called the robot (take the hour) | "HH" is the hour format, please crawl the article "App Script get current time" |
reply_message must be a content in JSON format. Taking text message as an example, the format is as follows:
reply_message = [{
" type " : " text " , // 除非是最後一句,每一句後面要加逗號
" text " : "引號內打要回傳的文字"
}]
Pictures, stickers, menus, and Flex Message graphic and text formats are also available. For details, please check the LINE official API document.
You are welcome to use this project for commercial and personal purposes under the MIT License. If you are willing to mark me as the source, it will be a great encouragement to me. Thank you! Feel free to fork this project and use it for your own work. However, it would be great if you credit me.