This package is for easy use of LINE WORKS.
import { Auth, Bot } from "jsr:@gazf/deno-lineworks";
const auth = new Auth({
clientId: "YOUR_LINEWORKS_CLIENT_ID",
clientSecret: "YOUR_LINEWORKS_CLIENT_SECRET",
serviceAccount: "YOUR_LINEWORKS_SERVICE_ACCOUNT",
privateKey: "YOUR_LINEWORKS_PRIVATE_KEY",
}, ["bot"]);
const bot = new Bot(
"YOUR_BOT_ID",
"YOUR_BOT_SECRET",
auth,
);
// send messeage to user
await bot.send("users", "user_id", {
content: {
type: "text",
text: "Bot send message",
},
});
// send messeage to channel
await bot.send("channels", "channel_id", {
content: {
type: "text",
text: "Bot send message",
},
});
import { Auth, Bot } from "jsr:@gazf/deno-lineworks";
import { Hono } from "jsr:@hono/hono";
const auth = new Auth({
clientId: "YOUR_LINEWORKS_CLIENT_ID",
clientSecret: "YOUR_LINEWORKS_CLIENT_SECRET",
serviceAccount: "YOUR_LINEWORKS_SERVICE_ACCOUNT",
privateKey: "YOUR_LINEWORKS_PRIVATE_KEY",
}, ["bot"]);
const bot = new Bot(
"YOUR_BOT_ID",
"YOUR_BOT_SECRET",
auth,
);
// Setup 'MessageCallback'
bot.on("message", (c) => {
return c.reply({
content: {
type: "text",
text: `echoback: ${c.e.content.text}`,
},
});
});
const app = new Hono();
app.mount("/path/to/callback", bot.fetch);
Deno.serve(app.fetch);
Distributed under the MIT License.