LINE Messaging API adapter for Chat SDK — send and receive messages from your bot.
npm install chat-adapter-lineimport { Chat } from "chat";
import { createLineAdapter } from "chat-adapter-line";
const bot = new Chat({
userName: "mybot",
adapters: {
line: createLineAdapter(),
},
});
bot.onNewMention(async (thread) => {
await thread.subscribe();
await thread.post("Hello! I'm listening to this thread.");
});
bot.onSubscribedMessage(async (thread, message) => {
await thread.post(`You said: ${message.text}`);
});the factory reads credentials from the environment variables by default.
| Environment Variable | Required | Description |
|---|---|---|
LINE_CHANNEL_ACCESS_TOKEN |
Yes | The access token for the LINE channel. |
LINE_CHANNEL_SECRET |
Yes | The secret for the LINE channel. |
or pass them as options to the factory:
const adapter = createLineAdapter({
channelAccessToken: "eyJhbG...",
channelSecret: "abc123...",
});This package includes targeted benchmarks for hot paths:
- Markdown normalization (
toPlainText) - Thread ID encode/decode
- Webhook signature + parse path
Run benchmarks:
vp run benchmarkExport JSON results:
vp run benchmark:json