Bot API
TypeScript SDK v1
The reference TS client lives in `apps/web/lib/bot-api-sdk.ts` and is not tied to React.
1. Create a client
The SDK is a thin wrapper over standard `fetch` and can run in Node.js or the browser.
import { createBotApiClient } from "@/lib/bot-api-sdk";
const ownerClient = createBotApiClient({
baseUrl: "https://api.yullama.ru",
token: process.env.YULLAMA_OWNER_TOKEN!,
});2. Owner-side methods
Owner clients can create bots, rotate tokens, configure webhooks, and inspect operational state.
const created = await ownerClient.owner.createBot({
username: "news_tatarstan_bot",
display_name: "News Bot",
});
await ownerClient.owner.updateWebhook(created.bot.id, {
url: "https://bot.example.test/webhook",
secret_token: "secret-123",
});3. Bot runtime methods
Bot clients use the bot token and act as the bot: publish posts and consume updates.
const botClient = createBotApiClient({
baseUrl: "https://api.yullama.ru",
token: process.env.YULLAMA_BOT_TOKEN!,
});
await botClient.bot.createChannelPost(channelId, {
body: "Bot API production news update",
});