Skip to content

MessageContext

Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:39

Context for a decoded message delivered to agent middleware.

MessageContentType = unknown

ContentTypes = unknown

new MessageContext<MessageContentType, ContentTypes>(__namedParameters): MessageContext<MessageContentType, ContentTypes>

Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:46

Create a context from a decoded message and its conversation.

MessageContextParams<MessageContentType, ContentTypes>

MessageContext<MessageContentType, ContentTypes>

ConversationContext.constructor

get client(): Client<ContentTypes>

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

Return the wrapped XMTP client.

Client<ContentTypes>

ConversationContext.client


get conversation(): ConversationType

Defined in: sdks/js/agent-sdk/src/core/ConversationContext.ts:59

Return the conversation that triggered this context.

ConversationType

ConversationContext.conversation


get isAllowed(): boolean

Defined in: sdks/js/agent-sdk/src/core/ConversationContext.ts:64

Whether the conversation consent state is allowed.

boolean

ConversationContext.isAllowed


get isDenied(): boolean

Defined in: sdks/js/agent-sdk/src/core/ConversationContext.ts:69

Whether the conversation consent state is denied.

boolean

ConversationContext.isDenied


get isUnknown(): boolean

Defined in: sdks/js/agent-sdk/src/core/ConversationContext.ts:74

Whether the conversation consent state is unknown.

boolean

ConversationContext.isUnknown


get message(): DecodedMessageWithContent<MessageContentType>

Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:144

Return the decoded message.

DecodedMessageWithContent<MessageContentType>

getClientAddress(): string | undefined

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

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

string | undefined

ConversationContext.getClientAddress


getSenderAddress(): Promise<string | undefined>

Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:136

Resolve the sender’s first identifier from the local inbox state.

Promise<string | undefined>


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

Defined in: sdks/js/agent-sdk/src/core/ConversationContext.ts:37

Narrow this context to a direct-message conversation.

this is ConversationContext<ContentTypes, Dm<ContentTypes>>

ConversationContext.isDm


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

Defined in: sdks/js/agent-sdk/src/core/ConversationContext.ts:42

Narrow this context to a group conversation.

this is ConversationContext<ContentTypes, Group<ContentTypes>>

ConversationContext.isGroup


isMarkdown(): this is MessageContext<string, unknown>

Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:63

Narrow the message to Markdown content.

this is MessageContext<string, unknown>


isReaction(): this is MessageContext<Reaction, unknown>

Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:78

Narrow the message to a reaction.

this is MessageContext<Reaction, unknown>


isReadReceipt(): this is MessageContext<ReadReceipt, unknown>

Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:83

Narrow the message to a read receipt.

this is MessageContext<ReadReceipt, unknown>


isRemoteAttachment(): this is MessageContext<RemoteAttachment, unknown>

Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:88

Narrow the message to a remote attachment.

this is MessageContext<RemoteAttachment, unknown>


isReply(): this is MessageContext<Reply, unknown>

Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:73

Narrow the message to a reply.

this is MessageContext<Reply, unknown>


isText(): this is MessageContext<string, unknown>

Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:68

Narrow the message to plain text content.

this is MessageContext<string, unknown>


isTransactionReference(): this is MessageContext<TransactionReference, unknown>

Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:93

Narrow the message to a transaction reference.

this is MessageContext<TransactionReference, unknown>


isWalletSendCalls(): this is MessageContext<WalletSendCalls, unknown>

Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:98

Narrow the message to wallet send calls.

this is MessageContext<WalletSendCalls, unknown>


sendMarkdownReply(markdown): Promise<void>

Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:126

Reply to this message with Markdown content.

string

Promise<void>


sendReaction(content, schema?): Promise<void>

Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:103

Send an added reaction that references this message.

string

ReactionSchema = ReactionSchema.Unicode

Promise<void>


sendRemoteAttachment(unencryptedFile, uploadCallback): Promise<void>

Defined in: sdks/js/agent-sdk/src/core/ConversationContext.ts:47

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

File

AttachmentUploadCallback

Promise<void>

ConversationContext.sendRemoteAttachment


sendTextReply(text): Promise<void>

Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:131

Reply to this message with plain text content.

string

Promise<void>


usesCodec<T>(codecClass): this is MessageContext<ReturnType<T["decode"]>, unknown>

Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:56

Narrow the message when its encoded type id matches the supplied codec.

T extends ContentCodec

() => T

this is MessageContext<ReturnType<T["decode"]>, unknown>