MessageContext
Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:39
Context for a decoded message delivered to agent middleware.
Extends
Section titled “Extends”ConversationContext<ContentTypes>
Type Parameters
Section titled “Type Parameters”MessageContentType
Section titled “MessageContentType”MessageContentType = unknown
ContentTypes
Section titled “ContentTypes”ContentTypes = unknown
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”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.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”MessageContextParams<MessageContentType, ContentTypes>
Returns
Section titled “Returns”MessageContext<MessageContentType, ContentTypes>
Overrides
Section titled “Overrides”ConversationContext.constructor
Accessors
Section titled “Accessors”client
Section titled “client”Get Signature
Section titled “Get Signature”get client():
Client<ContentTypes>
Defined in: sdks/js/agent-sdk/src/core/ClientContext.ts:23
Return the wrapped XMTP client.
Returns
Section titled “Returns”Client<ContentTypes>
Inherited from
Section titled “Inherited from”conversation
Section titled “conversation”Get Signature
Section titled “Get Signature”get conversation():
ConversationType
Defined in: sdks/js/agent-sdk/src/core/ConversationContext.ts:59
Return the conversation that triggered this context.
Returns
Section titled “Returns”ConversationType
Inherited from
Section titled “Inherited from”ConversationContext.conversation
isAllowed
Section titled “isAllowed”Get Signature
Section titled “Get Signature”get isAllowed():
boolean
Defined in: sdks/js/agent-sdk/src/core/ConversationContext.ts:64
Whether the conversation consent state is allowed.
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”isDenied
Section titled “isDenied”Get Signature
Section titled “Get Signature”get isDenied():
boolean
Defined in: sdks/js/agent-sdk/src/core/ConversationContext.ts:69
Whether the conversation consent state is denied.
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”isUnknown
Section titled “isUnknown”Get Signature
Section titled “Get Signature”get isUnknown():
boolean
Defined in: sdks/js/agent-sdk/src/core/ConversationContext.ts:74
Whether the conversation consent state is unknown.
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”message
Section titled “message”Get Signature
Section titled “Get Signature”get message():
DecodedMessageWithContent<MessageContentType>
Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:144
Return the decoded message.
Returns
Section titled “Returns”DecodedMessageWithContent<MessageContentType>
Methods
Section titled “Methods”getClientAddress()
Section titled “getClientAddress()”getClientAddress():
string|undefined
Defined in: sdks/js/agent-sdk/src/core/ClientContext.ts:18
Return the account identifier used by the client, when available.
Returns
Section titled “Returns”string | undefined
Inherited from
Section titled “Inherited from”ConversationContext.getClientAddress
getSenderAddress()
Section titled “getSenderAddress()”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.
Returns
Section titled “Returns”Promise<string | undefined>
isDm()
Section titled “isDm()”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.
Returns
Section titled “Returns”this is ConversationContext<ContentTypes, Dm<ContentTypes>>
Inherited from
Section titled “Inherited from”isGroup()
Section titled “isGroup()”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.
Returns
Section titled “Returns”this is ConversationContext<ContentTypes, Group<ContentTypes>>
Inherited from
Section titled “Inherited from”isMarkdown()
Section titled “isMarkdown()”isMarkdown():
this is MessageContext<string, unknown>
Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:63
Narrow the message to Markdown content.
Returns
Section titled “Returns”this is MessageContext<string, unknown>
isReaction()
Section titled “isReaction()”isReaction():
this is MessageContext<Reaction, unknown>
Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:78
Narrow the message to a reaction.
Returns
Section titled “Returns”this is MessageContext<Reaction, unknown>
isReadReceipt()
Section titled “isReadReceipt()”isReadReceipt():
this is MessageContext<ReadReceipt, unknown>
Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:83
Narrow the message to a read receipt.
Returns
Section titled “Returns”this is MessageContext<ReadReceipt, unknown>
isRemoteAttachment()
Section titled “isRemoteAttachment()”isRemoteAttachment():
this is MessageContext<RemoteAttachment, unknown>
Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:88
Narrow the message to a remote attachment.
Returns
Section titled “Returns”this is MessageContext<RemoteAttachment, unknown>
isReply()
Section titled “isReply()”isReply():
this is MessageContext<Reply, unknown>
Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:73
Narrow the message to a reply.
Returns
Section titled “Returns”this is MessageContext<Reply, unknown>
isText()
Section titled “isText()”isText():
this is MessageContext<string, unknown>
Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:68
Narrow the message to plain text content.
Returns
Section titled “Returns”this is MessageContext<string, unknown>
isTransactionReference()
Section titled “isTransactionReference()”isTransactionReference():
this is MessageContext<TransactionReference, unknown>
Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:93
Narrow the message to a transaction reference.
Returns
Section titled “Returns”this is MessageContext<TransactionReference, unknown>
isWalletSendCalls()
Section titled “isWalletSendCalls()”isWalletSendCalls():
this is MessageContext<WalletSendCalls, unknown>
Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:98
Narrow the message to wallet send calls.
Returns
Section titled “Returns”this is MessageContext<WalletSendCalls, unknown>
sendMarkdownReply()
Section titled “sendMarkdownReply()”sendMarkdownReply(
markdown):Promise<void>
Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:126
Reply to this message with Markdown content.
Parameters
Section titled “Parameters”markdown
Section titled “markdown”string
Returns
Section titled “Returns”Promise<void>
sendReaction()
Section titled “sendReaction()”sendReaction(
content,schema?):Promise<void>
Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:103
Send an added reaction that references this message.
Parameters
Section titled “Parameters”content
Section titled “content”string
schema?
Section titled “schema?”ReactionSchema = ReactionSchema.Unicode
Returns
Section titled “Returns”Promise<void>
sendRemoteAttachment()
Section titled “sendRemoteAttachment()”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.
Parameters
Section titled “Parameters”unencryptedFile
Section titled “unencryptedFile”File
uploadCallback
Section titled “uploadCallback”Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”ConversationContext.sendRemoteAttachment
sendTextReply()
Section titled “sendTextReply()”sendTextReply(
text):Promise<void>
Defined in: sdks/js/agent-sdk/src/core/MessageContext.ts:131
Reply to this message with plain text content.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<void>
usesCodec()
Section titled “usesCodec()”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.
Type Parameters
Section titled “Type Parameters”T extends ContentCodec
Parameters
Section titled “Parameters”codecClass
Section titled “codecClass”() => T
Returns
Section titled “Returns”this is MessageContext<ReturnType<T["decode"]>, unknown>

