Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Native
Skip to main content

Interface IMessage

interface IMessage
Extends com.amazon.apmf.IStandard The core messaging object. Supports both 1-to-1 and 1-to-many delivery, including a strongly-typed payload called an “attachment”. See IMessageBuilder.

Methods

getTargetUri()

string? getTargetUri()
The URI used to identify the target resource for this message. Outbound messages built via makeMessageBuilder(string targetUri) always carry a target URI. Response messages built via IMessage::makeResponseBuilder() may have nullptr here because they are routed by reply context, not by an explicit URI.

Returns

string? The return value is optional and might be absent. The destination URI that this message targets, or nullptr for response messages.

getAttachmentBytes()

com.amazon.apmf.IDataObjectByteView? getAttachmentBytes()
The serialized attachment payload, if one exists. The attachment is delivered to the receiver as a raw byte view of the Omnikit Data Object supplied by the sender; deserialization is the receiver’s responsibility. The receiver materializes a typed payload by passing the byte view through the GetDoFromArray<T> template, which performs compile-time-typed deserialization. The expected type is determined by the creator of the message and is typically stable per getTargetUri(). Example: deserialize a typed payload.

Returns

com.amazon.apmf.IDataObjectByteView? The return value is optional and might be absent. The serialized attachment associated with this message, or nullptr if no attachment was set.

getSenderCredential()

com.amazon.apmf.ICredential? getSenderCredential()
The credential of the message sender, used to verify whether the sender has appropriate privileges. The credential is stamped by the system at IMessagingModule::send() time. If the message was built using the builder but never sent, this returns nullptr because no sender context exists yet.

Returns

com.amazon.apmf.ICredential? The return value is optional and might be absent. The credential of the message sender, or nullptr if the message has not been sent.

getMessageProperties()

IMessageProperties* getMessageProperties()
The message properties associated with this message. The return is non-nullable: when the message builder did not call IMessageBuilder::messageProperties(), the system supplies a default IMessageProperties instance with no metadata, default priority, and no conflict-resolution hint.

Returns

IMessageProperties* The message properties object associated with this message; never nullptr.

makeResponseBuilder()

IMessageBuilder* makeResponseBuilder()
Creates a response message (builder) that will be delivered to target marked in the message. Must call IMessagingModule::send() to send the response.

Returns

IMessageBuilder* An instance of IMessageBuilder preconfigured to respond back to the caller.

Throws


Last modified on October 29, 2026