Bots
Bots: 5-minute path
Follow the real console flow: apply → token → delivery → reply with the SDK.
Minimal Echo (Node, polling)
import { StarIMBot } from '@starim-io/bot-sdk'
const bot = new StarIMBot({
token: process.env.SOCHAT_BOT_TOKEN!,
baseUrl: process.env.SOCHAT_API_BASE!, // e.g. https://api.example.com/api/v1
secretToken: process.env.SOCHAT_WEBHOOK_SECRET,
})
bot.on('message', async (ctx) => {
const text = ctx.message?.text
if (text) await ctx.reply(text)
})
// Ensure no webhook is configured before polling.
bot.startPolling()Webhook and polling cannot be enabled together. Delete the webhook in the console or call deleteWebhook before using getUpdates.
