https://github.com/louis70109/line-webhook-demo
LINE webhook demo project
https://github.com/louis70109/line-webhook-demo
Last synced: 2 months ago
JSON representation
LINE webhook demo project
- Host: GitHub
- URL: https://github.com/louis70109/line-webhook-demo
- Owner: louis70109
- License: mit
- Created: 2020-10-21T03:57:57.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-22T13:44:32.000Z (over 4 years ago)
- Last Synced: 2025-01-31T22:11:23.441Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 345 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LINE webhook demo
This is a sample for webhook demo.
## Deploy
[](https://heroku.com/deploy?template=https://github.com/louis70109/line-webhook-demo)
## LINE account
- Got A LINE Bot API devloper account
Make sure you already registered, if you need use LINE Bot.- Go to LINE Developer Console
- Close auto-reply setting on "Messaging API" Tab.
- Setup your basic account information. Here is some info you will need to know.
- Callback URL: `https://{NGROK_URL}/v1/webhooks/line`
- Verify your webhook.
- Enable bot join group button.
- You will get following info, need fill back to `.env` file.
- Channel Secret
- Channel Access Token (You need to issue one here)## Modify environment variables
When you deploy success, please copy LINE Bot channel `access token` and `secret` to environment variable:
```
CHANNEL_ACCESS_TOKEN
CHANNEL_SECRET
```## Migrate LINE Bot webhook url
Use the following command to change `endpoint URL`:
```bash
curl -X PUT "https://api.line.me/v2/bot/channel/webhook/endpoint" -H "Content-Type: application/json" -H "Authorization: Bearer TOKEN" -d '{"endpoint": "https://ENDPOINT_URL/v1/webhooks/line"}'
```In this case, you need to change `TOKEN` ➡️ your LINE Bot `access_token` and `ENDPOINT_URL` ➡️ `Heroku URL`
Then, you can change `v1` to `v2`, and you would see your Bot just echo `Hello World` 😆
Version detail:
- v1: echo bot
- v2: just echo "Hello World"Enjoy it!
## License
MIT