MessageContext
Defined in: sdks/agent/src/core/MessageContext.ts:29
A message and its client for agent middleware.
Extends
Section titled “Extends”ConversationContext<ContentTypes>
Type Parameters
Section titled “Type Parameters”Content
Section titled “Content”Content = unknown
ContentTypes
Section titled “ContentTypes”ContentTypes = unknown
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MessageContext<
Content,ContentTypes>(__namedParameters):MessageContext<Content,ContentTypes>
Defined in: sdks/agent/src/core/MessageContext.ts:36
Create a context for the received message and its conversation.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”MessageContextParams<Content, ContentTypes>
Returns
Section titled “Returns”MessageContext<Content, ContentTypes>
Overrides
Section titled “Overrides”ConversationContext.constructor
Accessors
Section titled “Accessors”client
Section titled “client”Get Signature
Section titled “Get Signature”get client():
Client
Defined in: sdks/agent/src/core/ClientContext.ts:23
Return the wrapped XMTP client.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”content
Section titled “content”Get Signature
Section titled “Get Signature”get content():
Content
Defined in: sdks/agent/src/core/MessageContext.ts:137
The decoded value selected by the content type.
Returns
Section titled “Returns”Content
Set Signature
Section titled “Set Signature”set content(
value):void
Defined in: sdks/agent/src/core/MessageContext.ts:128
Replace the middleware value without changing the SDK message.
Parameters
Section titled “Parameters”Content
Returns
Section titled “Returns”void
conversation
Section titled “conversation”Get Signature
Section titled “Get Signature”get conversation():
ConversationType
Defined in: sdks/agent/src/core/ConversationContext.ts:61
Return the conversation that triggered this context.
Returns
Section titled “Returns”ConversationType
Inherited from
Section titled “Inherited from”ConversationContext.conversation
message
Section titled “message”Get Signature
Section titled “Get Signature”get message():
Message
Defined in: sdks/agent/src/core/MessageContext.ts:133
The SDK message, including its tagged content and retained bytes.
Returns
Section titled “Returns”Methods
Section titled “Methods”consentState()
Section titled “consentState()”consentState():
Promise<ConsentState>
Defined in: sdks/agent/src/core/ConversationContext.ts:66
Return the conversation consent state.
Returns
Section titled “Returns”Promise<ConsentState>
Inherited from
Section titled “Inherited from”ConversationContext.consentState
getClientAddress()
Section titled “getClientAddress()”getClientAddress():
string
Defined in: sdks/agent/src/core/ClientContext.ts:18
Return the account identifier used by the client, when available.
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”ConversationContext.getClientAddress
getSenderAddress()
Section titled “getSenderAddress()”getSenderAddress():
Promise<string|undefined>
Defined in: sdks/agent/src/core/MessageContext.ts:120
Return the first identity identifier for the sender inbox.
Returns
Section titled “Returns”Promise<string | undefined>
isAllowed()
Section titled “isAllowed()”isAllowed():
Promise<boolean>
Defined in: sdks/agent/src/core/ConversationContext.ts:72
Whether the conversation consent state is allowed.
Returns
Section titled “Returns”Promise<boolean>
Inherited from
Section titled “Inherited from”isDenied()
Section titled “isDenied()”isDenied():
Promise<boolean>
Defined in: sdks/agent/src/core/ConversationContext.ts:77
Whether the conversation consent state is denied.
Returns
Section titled “Returns”Promise<boolean>
Inherited from
Section titled “Inherited from”isDm()
Section titled “isDm()”isDm():
this is ConversationContext<ContentTypes, Dm>
Defined in: sdks/agent/src/core/ConversationContext.ts:38
Narrow this context to a direct-message conversation.
Returns
Section titled “Returns”this is ConversationContext<ContentTypes, Dm>
Inherited from
Section titled “Inherited from”isGroup()
Section titled “isGroup()”isGroup():
this is ConversationContext<ContentTypes, Group>
Defined in: sdks/agent/src/core/ConversationContext.ts:43
Narrow this context to a group conversation.
Returns
Section titled “Returns”this is ConversationContext<ContentTypes, Group>
Inherited from
Section titled “Inherited from”isMarkdown()
Section titled “isMarkdown()”isMarkdown():
this is MessageContext<string, ContentTypes>
Defined in: sdks/agent/src/core/MessageContext.ts:51
Narrow this context to a Markdown message.
Returns
Section titled “Returns”this is MessageContext<string, ContentTypes>
isReaction()
Section titled “isReaction()”isReaction():
this is MessageContext<Reaction, ContentTypes>
Defined in: sdks/agent/src/core/MessageContext.ts:72
Narrow this context to a reaction message.
Returns
Section titled “Returns”this is MessageContext<Reaction, ContentTypes>
isReadReceipt()
Section titled “isReadReceipt()”isReadReceipt():
this is MessageContext<undefined, ContentTypes>
Defined in: sdks/agent/src/core/MessageContext.ts:76
Narrow this context to a read receipt.
Returns
Section titled “Returns”this is MessageContext<undefined, ContentTypes>
isRemoteAttachment()
Section titled “isRemoteAttachment()”isRemoteAttachment():
this is MessageContext<RemoteAttachment, ContentTypes>
Defined in: sdks/agent/src/core/MessageContext.ts:80
Narrow this context to a remote attachment.
Returns
Section titled “Returns”this is MessageContext<RemoteAttachment, ContentTypes>
isReply()
Section titled “isReply()”isReply():
this is MessageContext<{ body: MessageBody; kind: "reply"; referenceId: string }, ContentTypes>
Defined in: sdks/agent/src/core/MessageContext.ts:59
Narrow this context to a reply message.
Returns
Section titled “Returns”this is MessageContext<{ body: MessageBody; kind: "reply"; referenceId: string }, ContentTypes>
isText()
Section titled “isText()”isText():
this is MessageContext<string, ContentTypes>
Defined in: sdks/agent/src/core/MessageContext.ts:55
Narrow this context to a text message.
Returns
Section titled “Returns”this is MessageContext<string, ContentTypes>
isTransactionReference()
Section titled “isTransactionReference()”isTransactionReference():
this is MessageContext<TransactionReference, ContentTypes>
Defined in: sdks/agent/src/core/MessageContext.ts:84
Narrow this context to a transaction reference.
Returns
Section titled “Returns”this is MessageContext<TransactionReference, ContentTypes>
isUnknown()
Section titled “isUnknown()”isUnknown():
Promise<boolean>
Defined in: sdks/agent/src/core/ConversationContext.ts:82
Whether the conversation consent state is unknown.
Returns
Section titled “Returns”Promise<boolean>
Inherited from
Section titled “Inherited from”isWalletSendCalls()
Section titled “isWalletSendCalls()”isWalletSendCalls():
this is MessageContext<WalletSendCalls, ContentTypes>
Defined in: sdks/agent/src/core/MessageContext.ts:91
Narrow this context to wallet send calls.
Returns
Section titled “Returns”this is MessageContext<WalletSendCalls, ContentTypes>
sendMarkdownReply()
Section titled “sendMarkdownReply()”sendMarkdownReply(
markdown):Promise<void>
Defined in: sdks/agent/src/core/MessageContext.ts:112
Send a Markdown reply to this message with push disabled.
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/agent/src/core/MessageContext.ts:95
Send a reaction to this message with push disabled.
Parameters
Section titled “Parameters”content
Section titled “content”string
schema?
Section titled “schema?”ReactionSchema = "unicode"
Returns
Section titled “Returns”Promise<void>
sendRemoteAttachment()
Section titled “sendRemoteAttachment()”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.
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/agent/src/core/MessageContext.ts:116
Send a text reply to this message with push disabled.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<void>
usesCodec()
Section titled “usesCodec()”usesCodec<
T>(codecClass):this is MessageContext<ReturnType<T["decode"]>, ContentTypes>
Defined in: sdks/agent/src/core/MessageContext.ts:45
Check the codec authority, type name, and major version.
Type Parameters
Section titled “Type Parameters”T extends AnyContentCodec
Parameters
Section titled “Parameters”codecClass
Section titled “codecClass”() => T
Returns
Section titled “Returns”this is MessageContext<ReturnType<T["decode"]>, ContentTypes>