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

# RecordingProvider<P>

> Class exported by @botmesh/core.

Defined in: [testing/transcripts/record.ts:92](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L92)

Transparent [IProvider](https://botmesh.afaya.com.co/api/core/interfaces/IProvider.md) wrapper that records a transcript.

## Type Parameters

| Type Parameter | Default type |
| - | - |
|  `P` *extends* [`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider) | [`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider) |

## Implements

* [`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider)

## Constructors

### Constructor

```ts theme={null}
new RecordingProvider<P>(inner, options?): RecordingProvider<P>;
```

Defined in: [testing/transcripts/record.ts:119](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L119)

#### Parameters

| Parameter | Type |
| - | - |
| `inner` | `P` |
| `options?` | [`RecordTranscriptOptions`](https://botmesh.afaya.com.co/api/core/interfaces/RecordTranscriptOptions) |

#### Returns

`RecordingProvider`\<`P`>

## Properties

### id

```ts theme={null}
readonly id: string;
```

Defined in: [testing/transcripts/record.ts:93](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L93)

Stable transport tag (e.g. 'baileys', 'telegram') — used to namespace
conversation keys if one Bot ever runs multiple providers concurrently.

#### Implementation of

[`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider).[`id`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider#id)

***

### capabilities

```ts theme={null}
readonly capabilities: ProviderCapabilities;
```

Defined in: [testing/transcripts/record.ts:94](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L94)

#### Implementation of

[`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider).[`capabilities`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider#capabilities)

***

### inner

```ts theme={null}
readonly inner: P;
```

Defined in: [testing/transcripts/record.ts:95](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L95)

***

### ingest?

```ts theme={null}
ingest?: (rawEvent, headers?) => unknown;
```

Defined in: [testing/transcripts/record.ts:97](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L97)

Push ingress for webhook transports (Cloud API POST, Telegram/Discord
webhook, Discord interaction endpoint). The host HTTP server calls this with
the raw body (and, optionally, the request headers for signature checks); the
provider normalizes and emits via onEvent. May return a value the host can
use as the HTTP status (e.g. 200 accepted / 403 bad signature). Socket-first
providers (Baileys, Discord gateway) omit it.

#### Parameters

| Parameter | Type |
| - | - |
| `rawEvent` | `unknown` |
| `headers?` | `Record`\<`string`, `string` \| `string`\[] \| `undefined`> |

#### Returns

`unknown`

#### Implementation of

[`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider).[`ingest`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider#ingest)

***

### downloadMedia?

```ts theme={null}
downloadMedia?: (ref) => Promise<Buffer<ArrayBufferLike> | ReadableStream>;
```

Defined in: [testing/transcripts/record.ts:98](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L98)

Lazy media retrieval behind one signature for every download model.

#### Parameters

| Parameter | Type |
| - | - |
| `ref` | [`MediaRef`](https://botmesh.afaya.com.co/api/core/interfaces/MediaRef) |

#### Returns

`Promise`\<`Buffer`\<`ArrayBufferLike`> | `ReadableStream`>

#### Implementation of

[`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider).[`downloadMedia`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider#downloadmedia)

***

### serializeMediaRef?

```ts theme={null}
serializeMediaRef?: (ref) => 
  | SerializedMediaRef
  | undefined;
```

Defined in: [testing/transcripts/record.ts:99](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L99)

Durable journaling (`BotConfig.durability`): turn a live `MediaRef` into a JSON-safe,
versioned reference that [rehydrateMediaRef](https://botmesh.afaya.com.co/api/core/interfaces/IProvider.md#rehydratemediaref) can rebuild in another process, so a
replayed message (crash recovery, background retry) can still download its media.
Synchronous, cheap and side-effect free; a throw counts as "not durable". Return
`undefined` for a ref that must not be journaled (e.g. view-once media). Never include
credentials: the result is stored at rest with the inbound record.

#### Parameters

| Parameter | Type |
| - | - |
| `ref` | [`MediaRef`](https://botmesh.afaya.com.co/api/core/interfaces/MediaRef) |

#### Returns

\| [`SerializedMediaRef`](https://botmesh.afaya.com.co/api/core/interfaces/SerializedMediaRef)
\| `undefined`

#### Implementation of

[`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider).[`serializeMediaRef`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider#serializemediaref)

***

### rehydrateMediaRef?

```ts theme={null}
rehydrateMediaRef?: (stored, ref) => 
  | MediaRef
| Promise<MediaRef>;
```

Defined in: [testing/transcripts/record.ts:100](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L100)

Rebuild the `MediaRef` of a replayed message from what [serializeMediaRef](https://botmesh.afaya.com.co/api/core/interfaces/IProvider.md#serializemediaref) wrote.
`ref` is the journaled ref without its token. Pure decoding: it must not need the
transport to be connected. `stored` comes from storage and is UNTRUSTED: reject an
invalid, unknown-version or tampered value with a `ProviderError`.

#### Parameters

| Parameter | Type |
| - | - |
| `stored` | [`SerializedMediaRef`](https://botmesh.afaya.com.co/api/core/interfaces/SerializedMediaRef) |
| `ref` | `Omit`\<[`MediaRef`](https://botmesh.afaya.com.co/api/core/interfaces/MediaRef), `"token"`> |

#### Returns

\| [`MediaRef`](https://botmesh.afaya.com.co/api/core/interfaces/MediaRef)
\| `Promise`\<[`MediaRef`](https://botmesh.afaya.com.co/api/core/interfaces/MediaRef)>

#### Implementation of

[`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider).[`rehydrateMediaRef`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider#rehydratemediaref)

***

### getMessage?

```ts theme={null}
getMessage?: (ref) => Promise<
  | InboundMessage<unknown>
| undefined>;
```

Defined in: [testing/transcripts/record.ts:101](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L101)

Read-back seam for poll aggregation, quote-body resolution, retry decrypt.
Providers that don't need it no-op / omit it. Replaces the constructor-
injected `getMessage` callback baked into BaileysProvider today.

#### Parameters

| Parameter | Type |
| - | - |
| `ref` | [`MessageRef`](https://botmesh.afaya.com.co/api/core/interfaces/MessageRef) |

#### Returns

`Promise`\<
\| [`InboundMessage`](https://botmesh.afaya.com.co/api/core/interfaces/InboundMessage)\<`unknown`>
\| `undefined`>

#### Implementation of

[`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider).[`getMessage`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider#getmessage)

***

### markRead?

```ts theme={null}
markRead?: (refs) => Promise<void>;
```

Defined in: [testing/transcripts/record.ts:102](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L102)

#### Parameters

| Parameter | Type |
| - | - |
| `refs` | [`MessageRef`](https://botmesh.afaya.com.co/api/core/interfaces/MessageRef)\[] |

#### Returns

`Promise`\<`void`>

#### Implementation of

[`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider).[`markRead`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider#markread)

***

### typing?

```ts theme={null}
typing?: (chatId, state?) => Promise<void>;
```

Defined in: [testing/transcripts/record.ts:103](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L103)

#### Parameters

| Parameter | Type |
| - | - |
| `chatId` | `string` |
| `state?` | `"typing"` \| `"paused"` \| `"recording"` |

#### Returns

`Promise`\<`void`>

#### Implementation of

[`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider).[`typing`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider#typing)

***

### deleteMessage?

```ts theme={null}
deleteMessage?: (ref) => Promise<void>;
```

Defined in: [testing/transcripts/record.ts:104](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L104)

#### Parameters

| Parameter | Type |
| - | - |
| `ref` | [`MessageRef`](https://botmesh.afaya.com.co/api/core/interfaces/MessageRef) |

#### Returns

`Promise`\<`void`>

#### Implementation of

[`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider).[`deleteMessage`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider#deletemessage)

***

### editMessage?

```ts theme={null}
editMessage?: (ref, content) => Promise<SendResult<unknown>>;
```

Defined in: [testing/transcripts/record.ts:105](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L105)

#### Parameters

| Parameter | Type |
| - | - |
| `ref` | [`MessageRef`](https://botmesh.afaya.com.co/api/core/interfaces/MessageRef) |
| `content` | [`OutboundContent`](https://botmesh.afaya.com.co/api/core/type-aliases/OutboundContent) |

#### Returns

`Promise`\<[`SendResult`](https://botmesh.afaya.com.co/api/core/interfaces/SendResult)\<`unknown`>>

#### Implementation of

[`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider).[`editMessage`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider#editmessage)

***

### acknowledgeInteraction?

```ts theme={null}
acknowledgeInteraction?: (interactionId, opts?) => Promise<void>;
```

Defined in: [testing/transcripts/record.ts:106](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L106)

#### Parameters

| Parameter | Type |
| - | - |
| `interactionId` | `string` |
| `opts?` | \{ `text?`: `string`; `defer?`: `boolean`; } |
| `opts.text?` | `string` |
| `opts.defer?` | `boolean` |

#### Returns

`Promise`\<`void`>

#### Implementation of

[`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider).[`acknowledgeInteraction`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider#acknowledgeinteraction)

***

### maxTurns

```ts theme={null}
readonly maxTurns: number;
```

Defined in: [testing/transcripts/record.ts:110](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L110)

Max turns kept in memory (oldest dropped first).

## Methods

### start()

```ts theme={null}
start(): Promise<void>;
```

Defined in: [testing/transcripts/record.ts:150](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L150)

#### Returns

`Promise`\<`void`>

#### Implementation of

[`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider).[`start`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider#start)

***

### stop()

```ts theme={null}
stop(): Promise<void>;
```

Defined in: [testing/transcripts/record.ts:151](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L151)

#### Returns

`Promise`\<`void`>

#### Implementation of

[`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider).[`stop`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider#stop)

***

### onEvent()

```ts theme={null}
onEvent(listener): () => void;
```

Defined in: [testing/transcripts/record.ts:153](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L153)

Subscribe to the normalized event stream. Returns an unsubscriber.

#### Parameters

| Parameter | Type |
| - | - |
| `listener` | [`InboundListener`](https://botmesh.afaya.com.co/api/core/type-aliases/InboundListener) |

#### Returns

() => `void`

#### Implementation of

[`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider).[`onEvent`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider#onevent)

***

### send()

```ts theme={null}
send(
   chatId, 
   content, 
   options?
): Promise<SendResult<unknown>>;
```

Defined in: [testing/transcripts/record.ts:158](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L158)

Send normalized content. Rejects with a typed error (section 8) on failure.

#### Parameters

| Parameter | Type |
| - | - |
| `chatId` | `string` |
| `content` | [`OutboundContent`](https://botmesh.afaya.com.co/api/core/type-aliases/OutboundContent) |
| `options?` | [`SendOptions`](https://botmesh.afaya.com.co/api/core/interfaces/SendOptions) |

#### Returns

`Promise`\<[`SendResult`](https://botmesh.afaya.com.co/api/core/interfaces/SendResult)\<`unknown`>>

#### Implementation of

[`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider).[`send`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider#send)

## Accessors

### selfId

#### Get Signature

```ts theme={null}
get selfId(): string | null;
```

Defined in: [testing/transcripts/record.ts:147](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L147)

The bot's own user id once connected (for group mention matching). Optional.

##### Returns

`string` | `null`

The bot's own user id once connected (for group mention matching). Optional.

#### Implementation of

[`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider).[`selfId`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider#selfid)

***

### connection

#### Get Signature

```ts theme={null}
get connection(): unknown;
```

Defined in: [testing/transcripts/record.ts:148](https://github.com/andresayac/botmesh/blob/main/packages/core/src/testing/transcripts/record.ts#L148)

A single primary connection handle for DEBUGGING ONLY. Not a structural
guarantee of exactly one connection (Discord may hold many shard sockets).
Core must NOT reach through this for behavior.

##### Returns

`unknown`

A single primary connection handle for DEBUGGING ONLY. Not a structural
guarantee of exactly one connection (Discord may hold many shard sockets).
Core must NOT reach through this for behavior.

#### Implementation of

[`IProvider`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider).[`connection`](https://botmesh.afaya.com.co/api/core/interfaces/IProvider#connection)


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