A Line bot for making announcements from one Line group to multiple Line groups.
Make annoyncement | Activate bot with invite code |
---|---|
![]() |
![]() |
- python >= 3.8
- terraform >= 5
- aws account (each service used in this project is eligible for the AWS Free Tier)
-
Star this repo (thanks 😉)
-
Fork and clone your repo (could be a private one)
-
cd into
annoyncement-line-bot/terraform
-
Copy
example.tfvars
toprod.tfvars
-
Configure
prod.tfvars
- In
prod.tfvars
, changerepository
to your fork - Generate a
Github personal access token (classic)
- Go to https://github.com/settings/tokens/new
- Select
repo
andadmin:repo_hook
- In
prod.tfvars
, changegithub_access_token
to your token
- Create a line bot
- Go to https://developers.line.biz/console/
- Create a provider if you don't have one
- Create a new channel and select
Messaging API
- In
Basic settings
, scroll to bottom and copyChannel secret
- In
prod.tfvars
, replacelinebot_secret
with your secret
- In
- In
Messaging API
>Webhook settings
, typehttps://example.com
intoWebhook URL
and toggleUse webhook
. - In
Messaging API
, scroll to bottom and issue aChannel access token (long-lived)
- In
prod.tfvars
, replacelinebot_token
with your token
- In
- In
Messaging API
, scan the QRcode to add the bot as a friend
- Configure the line bot
- Go to https://manager.line.biz/ and go the settings page by click on your bot
- Click
設定
on the top right corner of the page - In
設定
>帳號設定
>功能切換
>加入群組或多人聊天室
, choose接受邀請加入群組或多人聊天室
- In
設定
>回應設定
>回應設定
, enableWebhook
and disable both加入好友的歡迎訊息
and自動回應訊息
- In
-
Apply the infrastructure
- Run
terraform init
- Run
terraform apply -var-file prod.tfvars
- Wait until
Apply complete!
shows up
- Run
-
Profit
- Invite the bot to the announcing group.
You will be prompted to set aninvite code
. - Invite the bot to receiving groups.
The bot will send a link in the group, enter the invite code to activate the bot - Make annoyncements
- In announcing group, type
annoy
orAnnoy
. - Wait until the bot replies.
- Enter a text message or image message as your announcement
- It will show up on the receiving groups shortly
- In announcing group, type
- Invite the bot to the announcing group.
-
Clean up
- Delete AWS resouces
- In
terraform
runterraform destroy -var-file prod.tfvars
- In
- Remove line bot
- Remove Github personal access token
- Delete AWS resouces