Skip to content

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:

bash
onebots ui --data-dir <workspace> --setup

The 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:

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

  1. Visit Line Developers Console
  2. Create a Provider (if you don't have one)
  3. Create a new Messaging API Channel
  4. Get the Channel Secret from the "Basic settings" page
  5. 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:

  1. Go to your Channel in Line Developers Console
  2. Find "Webhook settings" on the "Messaging API" page
  3. Set the Webhook URL to:
    https://your-domain.com/line/{account_id}/webhook
    For example:
    https://bot.example.com/line/my_bot/webhook
  4. Click "Verify" to verify the Webhook
  5. 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

TypeDescription
textText message
imageImage message
videoVideo message
audioAudio message
fileFile message
locationLocation message
stickerSticker message

Receiving Messages

TypeDescription
textText message
imageImage message
videoVideo message
audioAudio message
fileFile message
locationLocation message
stickerSticker message