plugins/plugin-line/README.md
LINE Messaging API plugin for ElizaOS agents. Enables chatbot integration with LINE, a popular messaging platform in Japan, Taiwan, and Thailand.
# npm
npm install @elizaos/plugin-line
# bun
bun add @elizaos/plugin-line
| Variable | Description | Required |
|---|---|---|
LINE_CHANNEL_ACCESS_TOKEN | Channel access token from LINE Developers Console | Yes |
LINE_CHANNEL_SECRET | Channel secret for webhook verification | Yes |
LINE_WEBHOOK_PATH | Webhook endpoint path | No |
LINE_DM_POLICY | DM policy: open, pairing, allowlist, disabled | No |
LINE_GROUP_POLICY | Group policy: open, allowlist, disabled | No |
LINE_ALLOW_FROM | Comma-separated user IDs for allowlist | No |
LINE_ENABLED | Enable/disable the plugin | No |
{
"plugins": ["@elizaos/plugin-line"],
"pluginParameters": {
"LINE_CHANNEL_ACCESS_TOKEN": "your-channel-access-token",
"LINE_CHANNEL_SECRET": "your-channel-secret",
"LINE_DM_POLICY": "pairing",
"LINE_GROUP_POLICY": "allowlist"
}
}
LINE messaging routes through the canonical MESSAGE action using
source: "line".
| Primary action | Operation | Description |
|---|---|---|
MESSAGE | send | Send text, flex, or location content to a user, group, or room |
MESSAGE | read_channel | Read recent LINE conversation history when available |
MESSAGE | list_channels | List recent LINE targets when available |
LINE does not register standalone planner providers. Chat and user context is exposed through the LINE message connector hooks.
U followed by 32 hex characters (e.g., U1234567890abcdef1234567890abcdef)C followed by 32 hex charactersR followed by 32 hex charactersimport { LineService } from "@elizaos/plugin-line";
// Get the middleware
const middleware = lineService.createMiddleware();
// Use with Express
app.post("/webhooks/line", middleware, async (req, res) => {
const events = req.body.events;
await lineService.handleWebhookEvents(events);
res.status(200).end();
});
LINE Flex Messages allow rich visual content. The plugin supports creating info card bubbles:
const flexMessage = {
altText: "Update Notification",
contents: {
type: "bubble",
body: {
type: "box",
layout: "vertical",
contents: [
{ type: "text", text: "Title", weight: "bold", size: "xl" },
{ type: "text", text: "Body content", margin: "md", wrap: true }
]
}
}
};
| Policy | Description |
|---|---|
open | Accept DMs from anyone |
pairing | Accept DMs and remember senders |
allowlist | Only accept from LINE_ALLOW_FROM list |
disabled | Don't accept any DMs |
| Policy | Description |
|---|---|
open | Respond to anyone in groups |
allowlist | Only respond to allowed users |
disabled | Don't respond in groups |
cd typescript && npm run build
npm test
isConnected(): Check connection statusgetBotInfo(): Get bot profilesendMessage(to, text, options?): Send text messagesendFlexMessage(to, flex): Send flex messagesendTemplateMessage(to, template): Send template messagesendLocationMessage(to, location): Send locationreplyMessage(replyToken, messages): Reply using tokengetUserProfile(userId): Get user profilegetGroupInfo(groupId): Get group infoleaveChat(chatId, chatType): Leave group/roomMIT