open-index/open-npm huggingface dataset:
npm package: @orisign/bot-sdk
Description: Typed SDK for building bots on top of bot-service
Latest version: 0.1.0

# `@orisign/bot-sdk`

Typed Node.js SDK for building bots on top of `bot-service`.

## Install

```bash
npm install @orisign/bot-sdk
```

```bash
bun add @orisign/bot-sdk
```

## Included

- `BotServiceClient` for HTTP access to `bot-service`
- `Markup` builders for inline/reply/remove/force-reply keyboards
- `BotModule` runtime with commands, callbacks, middleware, scenes and wizards
- `BotContext` with typed access to chat, user, message and session
- callback payload signing helpers

## Quick start

```ts
import { BotModule, BotServiceClient, Markup } from '@orisign/bot-sdk';

type Actions = {
  'order:confirm': { orderId: string };
};

const client = new BotServiceClient({
  baseUrl: 'http://localhost:4011',
  apiKey: process.env.BOT_ADMIN_API_KEY,
});

const bot = new BotModule<Actions>({
  botId: 'bot_123',
  client,
});

bot.command('start', async (ctx) => {
  await ctx.reply('Welcome', {
    replyMarkup: Markup.inlineKeyboard([
      [
        Markup.button.callback('Confirm', 'order:confirm', { orderId: 'ord_1' }, {
          secret: process.env.BOT_CALLBACK_SIGNING_SECRET,
        }),
      ],
    ]),
  });
});
```

## Publish

```bash
npm login
npm publish --access public
```