Line Adapter
The Line adapter supports connecting to onebots service through the Line Messaging API.
Status
✅ Implemented and Available
Features
- ✅ Message Sending/Receiving
- Private chat message sending/receiving
- Group message sending/receiving
- Room message sending/receiving
- Supports text, images, video, audio, files, location, stickers, and other message formats
- ✅ Message Management
- Reply messages
- Push messages
- ✅ User Management
- Get user profile
- Get group member profile
- Get room member profile
- ✅ Group Management
- Get group information
- Get group member list
- Leave group
- ✅ Room Management
- Get room member list
- Leave room
- ✅ Event Handling
- Message events
- Follow/Unfollow events
- Join/Leave group events
- Member joined/left events
- Postback events
Installation
Open Extensions in the Web console and select the adapter, or run:
onebots ui --data-dir <workspace> --setupThe manager installs the adapter and its required peer dependencies into a verified immutable runtime generation. Do not run package-manager install commands directly in the OneBots runtime directory.
Configuration
Configure Line account in config.yaml:
# Line bot account configuration
line.your_bot_id:
# Line platform configuration
channel_access_token: 'your_channel_access_token' # Channel Access Token, required
channel_secret: 'your_channel_secret' # Channel Secret, required
# Protocol configuration
onebot.v11:
access_token: 'your_v11_token'Getting Channel Access Token and Channel Secret
- Visit Line Developers Console
- Create a Provider (if you don't have one)
- Create a new Messaging API Channel
- Get the Channel Secret from the "Basic settings" page
- Generate or get the Channel Access Token from the "Messaging API" page
Webhook Configuration
The Line adapter uses Webhook mode to receive messages. After starting the service, configure the Webhook URL in Line Developers Console:
- Go to your Channel in Line Developers Console
- Find "Webhook settings" on the "Messaging API" page
- Set the Webhook URL to:For example:
https://your-domain.com/line/{account_id}/webhookhttps://bot.example.com/line/my_bot/webhook - Click "Verify" to verify the Webhook
- Enable "Use webhook"
Note
- Webhook URL must be HTTPS
- Ensure your server is accessible from the public internet
- Consider using a reverse proxy (like Nginx) in production
Client SDK Usage
Connect the client to the complete account protocol root, for example http://localhost:6727/line/{account_id}/onebot/v12. See the Client SDK Guide for Client creation, receive modes, existing-Host integration, and API calls.
Supported Message Types
Sending Messages
| Type | Description |
|---|---|
| text | Text message |
| image | Image message |
| video | Video message |
| audio | Audio message |
| file | File message |
| location | Location message |
| sticker | Sticker message |
Receiving Messages
| Type | Description |
|---|---|
| text | Text message |
| image | Image message |
| video | Video message |
| audio | Audio message |
| file | File message |
| location | Location message |
| sticker | Sticker message |