> ## Documentation Index
> Fetch the complete documentation index at: https://botmesh.afaya.com.co/llms.txt
> Use this file to discover all available pages before exploring further.

# botmesh

> A TypeScript framework for messaging bots. Write handlers and conversation flows once, run them on WhatsApp (Baileys or the official Cloud API) and Telegram, and try them in your terminal without a phone.

## One bot, every chat channel

> **[Get started](https://botmesh.afaya.com.co/guide/getting-started.md)**

> **[Your first bot](https://botmesh.afaya.com.co/guide/first-bot.md)**

> **[API reference](https://botmesh.afaya.com.co/api/core.md)**

> **[Transport-agnostic](https://botmesh.afaya.com.co/guide/channels.md)**
>
> One engine, many providers: @botmesh/baileys (WhatsApp Web), @botmesh/meta (official WhatsApp Cloud API), @botmesh/telegram, @botmesh/messenger, @botmesh/instagram, Discord, Twilio, email and more. Switching channels changes one line.

> **[Conversation flows](https://botmesh.afaya.com.co/guide/flows.md)**
>
> flow('signup').ask().choose().say() compiles to a real async conversation with validation, retries, branching and timeouts. Persistent flows survive a restart.

> **[Try it without a phone](https://botmesh.afaya.com.co/guide/dev-simulator.md)**
>
> npx botmesh dev bot.js chats with your bot in the terminal, with hot reload and no account, number or ban risk.

> **[Testable](https://botmesh.afaya.com.co/guide/testing.md)**
>
> createTestBot and MockProvider run your flows in unit tests with no network. Golden transcripts catch regressions in whole conversations.

> **[AI when you need it](https://botmesh.afaya.com.co/guide/ai.md)**
>
> @botmesh/ai answers with Anthropic, OpenAI, Gemini, Ollama or OpenAI-compatible models, calls your tools with confirmation and remembers each user.

> **[Hooks and plugins](https://botmesh.afaya.com.co/guide/plugins.md)**
>
> before / after / onError middleware on every message and send, and reusable plugins such as the built-in slash commands.

> **[Pluggable stores](https://botmesh.afaya.com.co/guide/store.md)**
>
> MemoryStore by default; SQLite, Redis, PostgreSQL, MySQL and MongoDB stores for persistence, or your own IStore.

> **[Ready for production](https://botmesh.afaya.com.co/guide/deploy.md)**
>
> Inbound dedupe on by default and an anti-ban rate limiter on Baileys; opt-in durable processing, multiple replicas, a durable scheduler and OpenTelemetry traces.

> **Typed throughout**
>
> ESM packages written in TypeScript: autocomplete and type checking on every handler, flow state and plugin. Plain JavaScript works too.

## A bot in a few lines

```js theme={null}
import { Bot, flow } from '@botmesh/core'
import { BaileysProvider } from '@botmesh/baileys'

const bot = new Bot({ provider: new BaileysProvider({ session: 'my-bot' }) })

bot.when('hi', (ctx) => ctx.reply('👋 Hello!'))

bot.use(
  flow('signup')
    .ask('What is your name?', 'name')
    .say((_ctx, c) => `Nice to meet you, ${c.state.name}!`),
)

await bot.start() // scan the QR with WhatsApp → Linked devices
```

Swap `BaileysProvider` for `TelegramProvider` or `CloudAPIProvider` and the
rest of the code stays the same.

## Start in five minutes

```bash theme={null}
npm create botmesh my-bot
cd my-bot && npm install
npm run dev        # chat with it in the terminal
npm start          # connect WhatsApp or Telegram
```

botmesh is in beta; see [Packages and versions](https://botmesh.afaya.com.co/guide/packages.md) for npm tags and package status.
[Getting started](https://botmesh.afaya.com.co/guide/getting-started.md) walks through every step, including setting up a
project by hand.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.