chat-adapter-line
v0.1.0
Published
LINE Messaging API adapter for Chat SDK
Downloads
238
Maintainers
Readme
Chat SDK LINE Adapter
LINE Messaging API adapter for Chat SDK — send and receive messages from your bot.
Installation
npm install chat-adapter-lineUsage
import { 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...",
});