This project is a simple LINE Messaging API bot using Google Apps Script (GAS) to send a monthly group reminder with a QR payment image and a mention to all group members.
📅 Sends a message on the 1st of every month.
- Sends custom text message
- Includes an image (e.g., QR code)
- Automatically runs every month using Google Apps Script Trigger
- LINE Messaging API (with your channel access token and group ID)
- Google Apps Script
- Internet access
- Go to LINE Developers Console
- Create a new provider and messaging API channel
- Enable
Messaging API
- Get your Channel Access Token
- Add your bot to a LINE group and send at least one message to retrieve the
groupId
- Go to Google Apps Script
- Create a new project
- Paste this code in
Code.gs
:
function sendLineNotification() {
const accessToken = 'YOUR_ACCESS_TOKEN'; // Replace this
const groupId = 'YOUR_GROUP_ID'; // Replace this
const messages = [
{
type: 'text',
text: '@All จ่ายเงินค่า Spotify ด้วยนะะ 36.5 บาท truemoney-xxxxxxxx',
mention: {
mentionees: [{
index: 0,
length: 4,
type: 'all'
}]
}
},
{
type: 'image',
originalContentUrl: 'https://YOUR-IMAGE-ADDRESSES.png',
previewImageUrl: 'https://YOUR-IMAGE-ADDRESSES.png'
}
];
const payload = {
to: groupId,
messages: messages
};
const options = {
method: 'post',
contentType: 'application/json',
headers: {
Authorization: 'Bearer ' + accessToken
},
payload: JSON.stringify(payload)
};
UrlFetchApp.fetch('https://api.line.me/v2/bot/message/push', options);
}
- Click the clock icon ⏰ in Apps Script to open "Triggers"
- Click + Add Trigger
- Choose the following:
Option | Value |
---|---|
Function to run | sendLineNotification |
Deployment | Head |
Event source | Time-driven |
Type of time-based trigger | Month timer |
Day of month | 1st |
Time of day | Your choice (e.g., 9AM) |
📷 QR Payment image and message:
@All จ่ายเงินค่า Spotify ด้วยนะะ 36.5 บาท truemoney-xxxxxxxx
- Do not expose your access token in public repositories. Use Script Properties for secrets.
- This project is for educational and personal use only.