Skip to content

SQSClient.send_message

rboto-sqs==0.4.0 · Service index · Types

Model summary (excerpt): Delivers a message to the specified queue. A message can include only XML, JSON, and unformatted text. The following Unicode characters are allowed. For more information, see the W3C specification for characters . #x9 | #xA | #xD | #x20 to #xD7FF | #xE000 to #xFFFD | #x10000 to #x10FFFF If a message contains characters outside the allowed set, Amazon SQS rejects the message and returns an...

Install and imports

python -m pip install "rboto[sqs]==0.4.0"
from rboto import SQSClient
from rboto_sqs.types import (
    MessageAttributeValue,
    MessageSystemAttributeNameForSends,
    MessageSystemAttributeValue,
    SendMessageOutput,
)

Signature

async def send_message(
    *,
    queue_url: str,
    message_body: str,
    delay_seconds: int | None = None,
    message_attributes: dict[str, MessageAttributeValue] | None = None,
    message_system_attributes: dict[MessageSystemAttributeNameForSends, MessageSystemAttributeValue] | None = None,
    message_deduplication_id: str | None = None,
    message_group_id: str | None = None,
) -> SendMessageOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
queue_url Yes The URL of the Amazon SQS queue to which a message is sent. Queue URLs and names are case-sensitive.
message_body Yes The message to send. The minimum size is one character. The maximum size is 1 MiB or 1,048,576 bytes A message can include only XML, JSON, and unformatted text. The following Unicode characters are allowed. For more information, see the W3C specification for characters . #x9 | #xA | #xD | #x20 to #xD7FF | #xE000 to #xFFFD | #x10000 to #x10FFFF If a message contains characters outside the...
delay_seconds No The length of time, in seconds, for which to delay a specific message. Valid values: 0 to 900. Maximum: 15 minutes. Messages with a positive DelaySeconds value become available for processing after the delay period is finished. If you don't specify a value, the default value for the queue applies. When you set FifoQueue , you can't set DelaySeconds per message. You can set this parameter only...
message_attributes No Each message attribute consists of a Name , Type , and Value . For more information, see Amazon SQS message attributes in the Amazon SQS Developer Guide .
message_system_attributes No The message system attribute to send. Each message system attribute consists of a Name , Type , and Value . Currently, the only supported message system attribute is AWSTraceHeader . Its type must be String and its value must be a correctly formatted X-Ray trace header string. The size of a message system attribute doesn't count towards the total size of a message.
message_deduplication_id No This parameter applies only to FIFO (first-in-first-out) queues. The token used for deduplication of sent messages. If a message with a particular MessageDeduplicationId is sent successfully, any messages sent with the same MessageDeduplicationId are accepted successfully but aren't delivered during the 5-minute deduplication interval. For more information, see Exactly-once processing in the...
message_group_id No MessageGroupId is an attribute used in Amazon SQS FIFO (First-In-First-Out) and standard queues. In FIFO queues, MessageGroupId organizes messages into distinct groups. Messages within the same message group are always processed one at a time, in strict order, ensuring that no two messages from the same group are processed simultaneously. In standard queues, using MessageGroupId enables fair...

Output

SendMessageOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
md5_of_message_body str | None Always present —
md5_of_message_attributes str | None Always present —
md5_of_message_system_attributes str | None Always present —
message_id str | None Always present —
sequence_number str | None Always present —

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

MessageAttributeValue, MessageSystemAttributeNameForSends, MessageSystemAttributeValue, SendMessageOutput

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_sqs.exceptions:

InvalidAddressError, InvalidMessageContentsError, InvalidSecurityError, KmsAccessDeniedError, KmsDisabledError, KmsInvalidKeyUsageError, KmsInvalidStateError, KmsNotFoundError, KmsOptInRequiredError, KmsThrottledError, QueueDoesNotExistError, RequestThrottledError, UnsupportedOperationError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Example

Complete, type-checked service example. Replace its placeholders and configure credentials before running it.

import asyncio

from rboto import SQSClient


async def main() -> None:
    client = SQSClient(region="us-east-1")
    response = await client.send_message(
        queue_url="https://sqs.us-east-1.amazonaws.com/123456789012/orders",
        message_body='{"order_id":"123"}',
    )
    print(response.message_id)


if __name__ == "__main__":
    asyncio.run(main())

Service guide · Pinned model