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

# ConversationRuntime

> One signed-in customer's support conversation in this tab: the transcript, the draft, pending sends, and the help offer.

One signed-in customer's support conversation in this tab: the transcript, the draft, pending
sends, and the help offer. Create it with `connectConversation`.

```typescript
class ConversationRuntime extends ConversationRuntime<File>
```

## Constructor

```typescript
ConversationRuntime(config: ConversationConfig): ConversationRuntime
```

### Parameters

<ResponseField name={"config"} type={"ConversationConfig"} typeHref={"/sdk/conversation/interfaces/ConversationConfig"} required />

### Returns

<code>[ConversationRuntime](/sdk/conversation/classes/ConversationRuntime)</code>

## Properties

<ResponseField name={"config"} type={"ConversationConfig"} typeHref={"/sdk/conversation/interfaces/ConversationConfig"} required>
  The configuration it was created with.
</ResponseField>

<ResponseField name={"offers"} type={"SupportOfferStore"} typeHref={"/sdk/conversation/interfaces/SupportOfferStore"} required>
  The Hinto Signal help offer for this subject's journeys. Reset by `updateAuth`.
</ResponseField>

## Methods

### addAttachments()

```typescript
addAttachments(files: Iterable<File>): AttachmentAddResult
```

Add picked, pasted, or dropped files to the draft and start uploading each accepted one.
Files the runtime refuses are reported and never uploaded.

#### Parameters

<ResponseField name={"files"} type={"Iterable<File>"} required />

#### Returns

<code>[AttachmentAddResult](/sdk/conversation/interfaces/AttachmentAddResult)</code>

### close()

```typescript
close(): void
```

Stops reading while the conversation is hidden. The draft and unread count are kept.

### destroy()

```typescript
destroy(): void
```

Stops everything for good. Call it when the host unmounts support.

### getSubject()

```typescript
getSubject(): string | null
```

The authenticated subject the runtime currently serves, or null after logout.

#### Returns

`string | null`

### markReadThrough()

```typescript
markReadThrough(conversationId: string, supportSequence: number): boolean
```

Advance the tab-scoped read cursor for the current conversation. Only an open runtime in a
visible document can mark replies read, the cursor never moves backwards, and it never moves
past a support reply this runtime has actually received.

#### Parameters

<ResponseField name={"conversationId"} type={"string"} required />

<ResponseField name={"supportSequence"} type={"number"} required />

#### Returns

`boolean`

### open()

```typescript
open(): Promise<ConversationOutcome>
```

Shows the conversation: loads it, sends a pending message or a queued help offer contact, and
keeps it current while open. Opening alone creates no ticket.

#### Returns

<code>{"Promise<"}[ConversationOutcome](/sdk/conversation/types/ConversationOutcome){">"}</code>

### removeAttachment()

```typescript
removeAttachment(localId: string): void
```

Remove a draft file. An upload in flight is cancelled.

#### Parameters

<ResponseField name={"localId"} type={"string"} required />

### retry()

```typescript
retry(): Promise<ConversationOutcome>
```

Sends the pending message again after a failure, or reloads when nothing is pending.

#### Returns

<code>{"Promise<"}[ConversationOutcome](/sdk/conversation/types/ConversationOutcome){">"}</code>

### retryAttachment()

```typescript
retryAttachment(localId: string): void
```

Upload a failed draft file again, when its bytes are still known.

#### Parameters

<ResponseField name={"localId"} type={"string"} required />

### send()

```typescript
send(options?: ConversationSendOptions): Promise<ConversationOutcome>
```

Send the draft. With `options.handoff`, the message opens a conversation that carries the
bot's reason, summary, and chat before it; a blank reason answers `invalid_draft`.

#### Parameters

<ResponseField name={"options"} type={"ConversationSendOptions"} typeHref={"/sdk/conversation/interfaces/ConversationSendOptions"} />

#### Returns

<code>{"Promise<"}[ConversationOutcome](/sdk/conversation/types/ConversationOutcome){">"}</code>

### setDraft()

```typescript
setDraft(draft: string): void
```

Replaces the customer's draft. It is kept for this tab across reloads.

#### Parameters

<ResponseField name={"draft"} type={"string"} required />

### shareBotMessage()

```typescript
shareBotMessage(message: { id: string; text: string }): Promise<BotMessageOutcome>
```

Mirror a message your bot showed the end user into the team's thread. Call it for every bot
message while a conversation is open, and right after `send({ handoff })` for the bot's own
goodbye: it waits for the conversation, keeps the order the user saw, and survives a reload.
The same `id` is recorded once.

#### Parameters

<ResponseField name={"message"} type={"{ id: string; text: string }"} required />

#### Returns

<code>{"Promise<"}[BotMessageOutcome](/sdk/conversation/types/BotMessageOutcome){">"}</code>

### snapshot()

```typescript
snapshot(): ConversationSnapshot<File>
```

The current state, transcript, and draft. Deep-frozen; the same object until it changes.

#### Returns

`ConversationSnapshot<File>`

### startNew()

```typescript
startNew(): ConversationOutcome
```

After the conversation is resolved, makes the next send start a new one.

#### Returns

<code>[ConversationOutcome](/sdk/conversation/types/ConversationOutcome)</code>

### subscribe()

```typescript
subscribe(listener: (snapshot: ConversationSnapshot<File>) => void): () => void
```

Calls the listener on every snapshot change. Returns a function that stops the calls.

#### Parameters

<ResponseField name={"listener"} type={"(snapshot: ConversationSnapshot<File>) => void"} required />

#### Returns

`() => void`

### sync()

```typescript
sync(): Promise<ConversationOutcome>
```

Reads the conversation now, while it is open.

#### Returns

<code>{"Promise<"}[ConversationOutcome](/sdk/conversation/types/ConversationOutcome){">"}</code>

### unreadCount()

```typescript
unreadCount(): number
```

Delivered support replies observed since this tab's baseline and not yet marked read. While
closed this is the last-known count; closing never schedules another read.

#### Returns

`number`

### updateAuth()

```typescript
updateAuth(auth: ConversationAuth | null): void
```

Switches to another signed-in customer, or signs out with null. Capture follows: the new
subject's identity, or a new anonymous session.

#### Parameters

<ResponseField name={"auth"} type={"ConversationAuth | null"} required>
  **Type:** <code>[ConversationAuth](/sdk/conversation/interfaces/ConversationAuth){" | null"}</code>
</ResponseField>


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