> ## 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.

# ConversationHandler<TTools>

> Type alias exported by @botmesh/core.

```ts theme={null}
type ConversationHandler<TTools> = (c, ctx) => Promise<unknown>;
```

Defined in: [conversations/handler.ts:32](https://github.com/andresayac/botmesh/blob/main/packages/core/src/conversations/handler.ts#L32)

Handler of `bot.conversation()`: an async function that drives one conversation.

`ctx` is the full `MessageContext` of the message that started it — reply helpers
(`photo`, `poll`, `react`, `quote`…), `senderInfo`, `chat`, and `ctx.tools` typed with every
`DefaultTools` augmentation (e.g. `ctx.tools.nlu` once `@botmesh/nlu` is imported). The
low-level `ConversationRuntime` keeps working with the minimal `RuntimeMessage`;
handlers written against that older, narrower type remain assignable to this one.
The resolved value is ignored, so `async (c, ctx) => ctx.reply('…')` is fine; the
conversation ends when the returned promise settles.

## Type Parameters

| Type Parameter | Default type | Description |
| - | - | - |
|  `TTools` *extends* `object` | [`DefaultTools`](https://botmesh.afaya.com.co/api/core/interfaces/DefaultTools) | Shape of `ctx.tools`; defaults to the (augmentable) `DefaultTools`. |

## Parameters

| Parameter | Type |
| - | - |
| `c` | [`ConversationControls`](https://botmesh.afaya.com.co/api/core/interfaces/ConversationControls) |
| `ctx` | [`MessageContext`](https://botmesh.afaya.com.co/api/core/interfaces/MessageContext)\<`TTools`> |

## Returns

`Promise`\<`unknown`>

## Example

```ts theme={null}
bot.conversation('foto', async (c, ctx) => {
  const img = await c.waitMedia(['image'], { timeout: '2m' })
  await ctx.react('📸')
  await ctx.reply(`Recibida (${img.type})`)
})
```


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