Skip to content

ConversationContext

Defined in: sdks/agent/src/core/ConversationContext.ts:17

Context for a conversation event and its client.

ContentTypes = unknown

ConversationType extends Conversation = Conversation

new ConversationContext<ContentTypes, ConversationType>(__namedParameters): ConversationContext<ContentTypes, ConversationType>

Defined in: sdks/agent/src/core/ConversationContext.ts:24

Create a context for a conversation.

Client

The client that owns the conversation.

ConversationType

The conversation that emitted the event.

ConversationContext<ContentTypes, ConversationType>

ClientContext.constructor

get client(): Client

Defined in: sdks/agent/src/core/ClientContext.ts:23

Return the wrapped XMTP client.

Client

ClientContext.client


get conversation(): ConversationType

Defined in: sdks/agent/src/core/ConversationContext.ts:61

Return the conversation that triggered this context.

ConversationType

consentState(): Promise<ConsentState>

Defined in: sdks/agent/src/core/ConversationContext.ts:66

Return the conversation consent state.

Promise<ConsentState>


getClientAddress(): string

Defined in: sdks/agent/src/core/ClientContext.ts:18

Return the account identifier used by the client, when available.

string

ClientContext.getClientAddress


isAllowed(): Promise<boolean>

Defined in: sdks/agent/src/core/ConversationContext.ts:72

Whether the conversation consent state is allowed.

Promise<boolean>


isDenied(): Promise<boolean>

Defined in: sdks/agent/src/core/ConversationContext.ts:77

Whether the conversation consent state is denied.

Promise<boolean>


isDm(): this is ConversationContext<ContentTypes, Dm>

Defined in: sdks/agent/src/core/ConversationContext.ts:38

Narrow this context to a direct-message conversation.

this is ConversationContext<ContentTypes, Dm>


isGroup(): this is ConversationContext<ContentTypes, Group>

Defined in: sdks/agent/src/core/ConversationContext.ts:43

Narrow this context to a group conversation.

this is ConversationContext<ContentTypes, Group>


isUnknown(): Promise<boolean>

Defined in: sdks/agent/src/core/ConversationContext.ts:82

Whether the conversation consent state is unknown.

Promise<boolean>


sendRemoteAttachment(unencryptedFile, uploadCallback?): Promise<void>

Defined in: sdks/agent/src/core/ConversationContext.ts:48

Encrypt and send a remote attachment through the supplied upload callback.

File

AttachmentUploadCallback

Promise<void>