The SendMessage action delivers a message to the specified queue.
For SOAP requests, you must provide the message text in the MessageBody parameter. The size of the message cannot exceed 256 KB.
For Query requests, you can provide the message text in one of two ways:
MessageBody parameter in the URL—The size of the message cannot exceed 8 KB and the text must be URL encoded.MessageBody parameter in the request. If you do, the body of the HTTP request will be ignored. You also must include the Content-Type HTTP header with the value set to text/plain. Note that the authentication signature you provide (see Query Request Authentication) is still only based on the request parameters in the URL; because the message text is included as the body of the HTTP request and not as a parameter in the URL, you do not include the text of the message in the string when creating the signature.![]() | Important |
|---|---|
The following list shows the characters (in Unicode) allowed in your message (according to http://www.w3.org/TR/REC-xml/#charsets). If you send any characters not included in the list, your request will be rejected. #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] |
The following table lists the special request parameters the action uses (in addition to the common request parameters listed in Common Request Parameters).
| Name | Description | Required |
|---|---|---|
| The message to send. Type: URL-encoded string maximum 8 KB in size (for Query requests); string maximum 256 KB in size (for SOAP requests). See the important note above for a list of allowed characters. Condition: Required for Query requests using the GET method and for all SOAP requests. | Conditional |
The following table lists the response elements the action returns (in addition to the common response elements listed in The Structure of a Response).
| Name | Description |
|---|---|
| An element containing the message ID of the message sent to the queue. You use this value when performing actions on the message. Ancestor: |
The following table lists the special errors the action returns (in addition to the common errors listed in Common Errors).
| Error | Description | HTTP Status Code |
|---|---|---|
InvalidMessageContents | The message contains characters outside the allowed set. | 400 |
The following example SendMessage request sends a message containing "Your Message Text" to the queue. This example sends the message using the MessageBody parameter.
http://queue.amazonaws.com/A29E9VSPHGOG23/queue1 ?Action=SendMessage &MessageBody=Your%20Message%20Text &AWSAccessKeyId=0GS7553JW74RRM612K02EXAMPLE &Version=2007-05-01 &Expires=2007-05-12T12:00:00Z &Signature=lB/P67vCvGlDMBQ1dofZxg8E8SUEXAMPLE=
The following example specifies the message text in the HTTP request body.
POST /http://queue.amazonaws.com/A29E9VSPHGOG23/queue1 ?Action=SendMessage &AWSAccessKeyId=0GS7553JW74RRM612K02EXAMPLE &Version=2007-05-01 &Expires=2007-05-12T12:00:00Z &Signature=lB/P67vCvGlDMBQ1dofZxg8E8SUEXAMPLE= HTTP/1.1 Content-Type: text/plain Your Message Text