Skip to content

Quick Start

HTTP Client

npm version npm downloads
Terminal window
npm install @effect-ak/tg-bot-client
import { makeTgBotClient } from "@effect-ak/tg-bot-client"
const client = makeTgBotClient({
bot_token: "YOUR_BOT_TOKEN"
})
const result = await client.execute("send_message", {
chat_id: "123456789",
text: "Hello, World!"
})
if (result.ok) {
console.log("Sent:", result.data.message_id)
}

Bot Runner

npm version npm downloads
Terminal window
npm install @effect-ak/tg-bot
import { createBot } from "@effect-ak/tg-bot"
createBot()
.onMessage(({ command, text }) => [
command("/start", ({ ctx }) => ctx.reply("Welcome!")),
text(({ update, ctx }) => ctx.reply(`You said: ${update.text}`))
])
.run({
bot_token: "YOUR_BOT_TOKEN"
})

API Types only

npm version npm downloads

If you only need TypeScript type definitions:

Terminal window
npm install @effect-ak/tg-bot-api