LINE Platform Skill
This skill provides specialized knowledge and workflows for developing on the LINE Platform.
Core Capabilities
- Messaging API (Chatbots)
-
Webhook Handling: Signature verification and event processing (message, follow, join, etc.).
-
Sending Messages: Reply, Push, Multicast, and Broadcast messages.
-
Message Types: Text, Sticker, Image, Video, Audio, Location, Flex Messages, and Templates.
-
Rich Menus: Setting, getting, and switching per-user rich menus.
-
User Profile: Retrieving display name and status message with user ID.
See references/messaging-api.md for detailed JSON schemas and endpoints.
- LIFF (LINE Front-end Framework)
-
SDK Integration: Using CDN or npm.
-
Initialization: liff.init() and login state management.
-
Interaction: Sending messages from LIFF, sharing content, and scanning QR codes.
-
Context: Accessing user IDs and group IDs from the app's context.
See references/liff.md for core SDK methods.
- LINE Login
-
OAuth 2.1 Flow: Authorization request, token exchange, and token management.
-
ID Tokens (JWT): Securely extracting user profiles (including email).
-
Auto Login: Best practices for implementing auto login.
See references/login.md for the complete auth flow.
Common Workflows
Creating a Chatbot
-
Set up a Provider and Messaging API Channel in the LINE Developers Console.
-
Issue a Channel Access Token.
-
Register a Webhook URL on your server.
-
Implement Signature Verification (using your Channel Secret).
-
Handle incoming events (e.g., type: "message" ) and respond using the Reply Token.
Developing a LIFF App
-
Create a LINE Login Channel.
-
Add a LIFF App to the channel and get a LIFF ID .
-
Use the LIFF Starter template from assets/liff-starter/index.html to begin development.
-
Call liff.init({ liffId: '...' }) as the first step in your JavaScript.
-
Use liff.sendMessages() to interact with the chat or liff.getProfile() to get user info.
Reusable Resources
Scripts
- scripts/flex_builder.py : Generates a basic Flex Message bubble JSON.
Assets
- assets/liff-starter/index.html : A minimal LIFF app template.
Important Note on Security
-
Channel Secret: Never expose your Channel Secret in client-side code (like LIFF). Use it only on your server for signature verification.
-
Channel Access Token: Store it securely and never commit it to source control. Use Environment Variables.
-
Signature Verification: Always verify the x-line-signature header in webhooks to ensure requests come from LINE.