LINE
Complete reference for the agent-line CLI.
Tip: After
npm install -g agent-messenger,agent-lineis available directly. For one-off execution without a global install you can usenpm exec --package agent-messenger agent-line ...,pnpm dlx --package agent-messenger agent-line ...,yarn dlx agent-messenger agent-line ..., orbunx --package agent-messenger agent-line ....
Key Concepts
Before diving in, a few things about LINE's architecture:
| Term | Description |
|---|---|
| MID | LINE's unique identifier for users, chats, and rooms. Prefixed with u (user), c (group chat), or r (room). |
| QR code login | The primary authentication method. Scan a QR code with the LINE mobile app to authorize the CLI. |
| ANDROIDSECONDARY | The default device type. Registers as a secondary Android device so your phone and desktop sessions stay active. |
| E2EE (Letter Sealing) | LINE's end-to-end encryption. The CLI encrypts and decrypts E2EE messages when key material is available, restoring keys saved by a prior QR/email login. It attempts E2EE first and falls back to plaintext otherwise. Chats that require E2EE reject the fallback and fail with e2ee_required when no key material is present. |
| Device types | Controls which device slot the CLI occupies. Secondary devices coexist with your other sessions. |
| PIN verification | During login, LINE may display a PIN that you confirm on your phone to authorize the new device. |
Quick Start
# 1. Login (QR code — opens in browser, scan with LINE app)
agent-line auth login
# 2. List chat rooms
agent-line chat list
# 3. Send a message
agent-line message send <chat-id> "Hello from agent-line!"
# 4. List messages in a chat
agent-line message list <chat-id>Authentication
LINE offers three authentication methods. QR code login is recommended because it doesn't require your email or password.
Method 1: QR Code Login (Recommended)
Registers the CLI as a secondary device using the ANDROIDSECONDARY slot by default. Your phone and desktop sessions keep running.
# Interactive — opens QR code in browser + prints to terminal
agent-line auth loginOn login:
- The CLI generates a QR code URL and opens it in your browser
- The QR code also prints in the terminal as a fallback
- Scan the QR code with the LINE mobile app
- LINE may display a PIN to confirm on your phone
- Login completes automatically after confirmation
Method 2: Email/Password Login
Uses email and password credentials. LINE may still require PIN verification on your phone.
# Interactive — prompts for email and password
agent-line auth login --email user@example.com --password mypassMethod 3: Token Login
Directly authenticates with an existing auth token. Useful when you already have a valid token from another source.
agent-line auth login --token <auth-token>Device Types
LINE allows multiple simultaneous sessions depending on the device type:
| Device | Default? | Side Effect |
|---|---|---|
| ANDROIDSECONDARY | Yes | Secondary device, coexists with all sessions |
| IOSIPAD | No | Secondary device, coexists with all sessions |
| DESKTOPMAC | No | Replaces existing macOS desktop session |
| DESKTOPWIN | No | Replaces existing Windows desktop session |
# Default: ANDROIDSECONDARY (safe for most users)
agent-line auth login
# Use iPad slot instead
agent-line auth login --device IOSIPAD
# Replace desktop session (kicks LINE desktop)
agent-line auth login --device DESKTOPMACNon-Interactive Mode (AI Agents)
When running outside a TTY (no interactive terminal), the CLI returns a next_action JSON response instead of displaying the QR code:
{
"next_action": "run_interactive",
"message": "QR code login requires an interactive terminal. Run agent-line auth login in a terminal with TTY support."
}For non-interactive environments, use --email/--password or --token to authenticate without a QR code.
Auth Management
# Check auth status
agent-line auth status
# List all stored accounts
agent-line auth list
# Switch active account
agent-line auth use <account-id>
# Remove stored credentials
agent-line auth logout
agent-line auth logout <account-id>Commands
Whoami Command
# Show current authenticated user
agent-line whoami
agent-line whoami --prettyOutput includes:
mid— your LINE user IDdisplay_name— your display namestatus_message— your status messagepicture_url— profile picture URL
Friend Commands
# List all friends
agent-line friend list
agent-line friend list --prettyOutput includes:
mid— friend's LINE user IDdisplay_name— friend's display namestatus_message— friend's status messagepicture_url— friend's profile picture URL
Chat Commands
# List conversations (DMs and groups)
agent-line chat list
agent-line chat list --pretty
# Limit number of chats returned
agent-line chat list -n 20Output includes:
chat_id— MID of the chat (u/c/r prefix)type— chat type (user, group, room, square)display_name— chat or contact namemember_count— number of members (groups only)
Message Commands
# List messages in a chat room
agent-line message list <chat-id>
agent-line message list <chat-id> -n 50
agent-line message list <chat-id> --pretty
# Send a text message
agent-line message send <chat-id> "Hello world"
agent-line message send <chat-id> "Hello world" --prettyEach message includes:
message_id— unique message identifierchat_id— which chat the message belongs toauthor_id— sender's MIDauthor_name— sender's display name, resolved from contacts (omitted when it can't be resolved)text— message text content (null for non-text or undecryptable messages). Letter Sealing (E2EE) messages are decrypted automatically when key material is availabledecryption_error— present only when an E2EE message couldn't be decrypted;{ code, message }wherecodeismissing_e2ee_keyordecrypt_failedcontent_type— message type (NONE = text, IMAGE, VIDEO, etc.)sent_at— ISO 8601 timestamp
Fetching More Messages
Use the -n flag to control how many messages to fetch in a single request:
# Get latest 20 messages (default)
agent-line message list c7a8b9c0d1e2f3a4b5c6d7e8
# Get 50 messages
agent-line message list c7a8b9c0d1e2f3a4b5c6d7e8 -n 50
# Get 200 messages
agent-line message list c7a8b9c0d1e2f3a4b5c6d7e8 -n 200Global Options
| Option | Description |
|---|---|
--pretty | Human-readable output instead of JSON |
Storage
- Credentials stored in
~/.config/agent-messenger/line-credentials.json(0600 permissions) - E2EE key storage in
~/.config/agent-messenger/line-storage/
Limitations
- No file upload or download
- No channel/chat room creation or management
- No reactions or emoji
- No message editing or deletion
- No search across chats
- Plain text messages only (no photos, videos, or rich content)
- Sending to chats that require E2EE (Letter Sealing) needs E2EE key material from a prior QR/email login; without it such sends fail with
e2ee_required - Chat IDs are MID strings, not human-readable — use
chat listto discover them
Troubleshooting
agent-line: command not found
agent-line is NOT the npm package name. The npm package is agent-messenger.
# If installed globally
agent-line chat list --pretty
# If not installed, use --package
npx -y --package agent-messenger agent-line chat list --prettyNEVER run npx agent-line without --package agent-messenger. It will fail or install a wrong package.
No credentials found
If auth status shows no account:
- Run
agent-line auth loginto authenticate via QR code - Or use
agent-line auth login --email ... --password ...for email login - Verify it worked with
agent-line auth status
QR code not displaying
If the QR code doesn't open in your browser:
- Check the terminal output for the ASCII QR code fallback
- The QR URL is also printed — you can open it manually
- Make sure you're running in an interactive terminal (TTY)
E2EE errors
The CLI tries E2EE (Letter Sealing) first and falls back to plaintext when possible, so most messages still send. When E2EE key material is available — restored from a prior QR/email login — the CLI encrypts and decrypts those messages. Chats that require E2EE reject the plaintext fallback, so if no key material is present the send fails with e2ee_required. Re-run agent-line auth login (QR) to provision E2EE keys.
PIN verification timeout
If the PIN expires before you confirm on your phone:
- Run
agent-line auth loginagain — a new QR code and PIN will be generated - Confirm the PIN on your phone within the time limit
- The CLI automatically completes login after confirmation
SDK Usage
For programmatic access, import LineClient directly:
import { LineClient } from 'agent-messenger/line'
const client = await new LineClient().login()
try {
const profile = await client.getProfile()
console.log(profile.display_name)
const chats = await client.getChats()
const firstChat = chats[0]
if (!firstChat) throw new Error('No chats available')
await client.sendMessage(firstChat.chat_id, 'Hello from SDK!')
} finally {
client.close()
}AI Agent Integration
See skills/agent-line/ for:
- Complete skill documentation
- Common patterns for AI agent workflows