- Webhook (verify x-line-signature)
- Event routing: message / follow / unfollow / postback / beacon (ตัวอย่าง)
- Reply / Push / Multicast
- Rich Menu API : create / list / get / upload image / set default / link user / unlink user / delete
- Scripts สำหรับสั่งทำ Rich Menu แบบ CLI
- Messaging API channel
- Copy: Channel access token (long-lived) และ Channel secret
- ใส่ใน
.env(คัดลอกจาก.env.example)
npm i
npm run dev
# เปิด webhook: POST http://localhost:3000/webhookต้องมี userId ก่อน (ได้จาก event follow/message)
curl -X POST http://localhost:3000/api/push \
-H "Content-Type: application/json" \
-d '{"to":"Uxxxxxxxx","text":"Hello push"}'npm run richmenu:createจะได้ richMenuId แสดงออกมา
ใส่ไฟล์รูปไว้ที่ assets/richmenu.png หรือระบุ env RICHMENU_IMAGE_PATH
npm run richmenu:upload -- <RICHMENU_ID>npm run richmenu:set-default -- <RICHMENU_ID>npm run richmenu:link -- <RICHMENU_ID> <USER_ID>npm run richmenu:unlink -- <USER_ID>npm run richmenu:delete -- <RICHMENU_ID>หมายเหตุ: ตัวอย่าง rich menu อยู่ที่
richmenu/richmenu.sample.json