PinpointSMSVoiceV2 / Client / send_rcs_message
send_rcs_message¶
- PinpointSMSVoiceV2.Client.send_rcs_message(**kwargs)¶
Creates a new RCS message and sends it to a recipient’s phone number. RCS messages support rich content including text, files, rich cards, and carousels with interactive suggested actions.
See also: AWS API Documentation
Request Syntax
response = client.send_rcs_message( DestinationPhoneNumber='string', OriginationIdentity='string', RcsMessageContent={ 'Content': { 'TextMessage': { 'Body': 'string' }, 'FileMessage': { 'FileUrl': 'string', 'ThumbnailUrl': 'string' }, 'RichCard': { 'CardOrientation': 'string', 'ThumbnailImageAlignment': 'string', 'CardContent': { 'Title': 'string', 'Description': 'string', 'Media': { 'FileUrl': 'string', 'ThumbnailUrl': 'string', 'Height': 'string' }, 'Suggestions': [ { 'Reply': { 'Text': 'string', 'PostbackData': 'string' }, 'OpenUrl': { 'Text': 'string', 'PostbackData': 'string', 'Url': 'string', 'Application': 'string', 'WebviewViewMode': 'string' }, 'DialPhone': { 'Text': 'string', 'PostbackData': 'string', 'PhoneNumber': 'string' }, 'ShowLocation': { 'Text': 'string', 'PostbackData': 'string', 'Latitude': 123.0, 'Longitude': 123.0, 'Label': 'string' }, 'RequestLocation': { 'Text': 'string', 'PostbackData': 'string' }, 'CreateCalendarEvent': { 'Text': 'string', 'PostbackData': 'string', 'Title': 'string', 'StartTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'Description': 'string' } }, ] } }, 'Carousel': { 'CardWidth': 'string', 'CardContents': [ { 'Title': 'string', 'Description': 'string', 'Media': { 'FileUrl': 'string', 'ThumbnailUrl': 'string', 'Height': 'string' }, 'Suggestions': [ { 'Reply': { 'Text': 'string', 'PostbackData': 'string' }, 'OpenUrl': { 'Text': 'string', 'PostbackData': 'string', 'Url': 'string', 'Application': 'string', 'WebviewViewMode': 'string' }, 'DialPhone': { 'Text': 'string', 'PostbackData': 'string', 'PhoneNumber': 'string' }, 'ShowLocation': { 'Text': 'string', 'PostbackData': 'string', 'Latitude': 123.0, 'Longitude': 123.0, 'Label': 'string' }, 'RequestLocation': { 'Text': 'string', 'PostbackData': 'string' }, 'CreateCalendarEvent': { 'Text': 'string', 'PostbackData': 'string', 'Title': 'string', 'StartTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'Description': 'string' } }, ] }, ] } }, 'Suggestions': [ { 'Reply': { 'Text': 'string', 'PostbackData': 'string' }, 'OpenUrl': { 'Text': 'string', 'PostbackData': 'string', 'Url': 'string', 'Application': 'string', 'WebviewViewMode': 'string' }, 'DialPhone': { 'Text': 'string', 'PostbackData': 'string', 'PhoneNumber': 'string' }, 'ShowLocation': { 'Text': 'string', 'PostbackData': 'string', 'Latitude': 123.0, 'Longitude': 123.0, 'Label': 'string' }, 'RequestLocation': { 'Text': 'string', 'PostbackData': 'string' }, 'CreateCalendarEvent': { 'Text': 'string', 'PostbackData': 'string', 'Title': 'string', 'StartTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'Description': 'string' } }, ] }, TimeToLive=123, MessageTrafficType='string', FallbackConfiguration={ 'Channel': 'SMS'|'MMS', 'MessageBody': 'string', 'MediaUrls': [ 'string', ], 'OriginationIdentity': 'string' }, ProtectConfigurationId='string', ConfigurationSetName='string', MaxPrice='string', DryRun=True|False, Context={ 'string': 'string' }, MessageFeedbackEnabled=True|False )
- Parameters:
DestinationPhoneNumber (string) –
[REQUIRED]
The destination phone number in E.164 format.
OriginationIdentity (string) –
[REQUIRED]
The origination identity of the message. This can be either the RcsAgentId, RcsAgentArn, PoolId, or PoolArn.
RcsMessageContent (dict) –
The content of the RCS message. Contains the message content (text, file, rich card, or carousel) and optional message-level suggested actions.
Content (dict) – [REQUIRED]
The content of the RCS message. Exactly one content type must be specified: TextMessage, FileMessage, RichCard, or Carousel.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
TextMessage,FileMessage,RichCard,Carousel.TextMessage (dict) –
A plain text RCS message.
Body (string) – [REQUIRED]
The text body of the RCS message. Maximum 3072 characters.
FileMessage (dict) –
A file message containing a media file (image, video, audio, or PDF) with an optional thumbnail.
FileUrl (string) – [REQUIRED]
The S3 URI of the media file to send, in the format
s3://bucket-name/key. The service downloads the file from your S3 bucket, rehosts it, and generates a presigned URL for the aggregator. Maximum 2000 characters.ThumbnailUrl (string) –
The S3 URI of an optional thumbnail image for the media file, in the format
s3://bucket-name/key. Maximum 2000 characters.
RichCard (dict) –
A standalone rich card with media, title, description, and suggested actions.
CardOrientation (string) – [REQUIRED]
The orientation of the rich card. Valid values are HORIZONTAL and VERTICAL.
ThumbnailImageAlignment (string) –
The alignment of the thumbnail image in a horizontal card. Valid values are LEFT and RIGHT. Only applicable when CardOrientation is HORIZONTAL.
CardContent (dict) – [REQUIRED]
The content of the rich card, including title, description, media, and card-level suggested actions.
Title (string) –
The title of the card. Maximum 200 characters.
Description (string) –
The description text of the card. Maximum 2000 characters.
Media (dict) –
The media content of the card, including the file URL, optional thumbnail, and display height.
FileUrl (string) – [REQUIRED]
The S3 URI of the media file for the card, in the format
s3://bucket-name/key. Maximum 2000 characters.ThumbnailUrl (string) –
The S3 URI of an optional thumbnail image for the card media. Maximum 2000 characters.
Height (string) –
The display height of the media in the card. Valid values are SHORT, MEDIUM, and TALL.
Suggestions (list) –
Card-level suggested actions. Maximum 4 suggestions per card.
(dict) –
A suggested action displayed to the RCS message recipient. Can be a reply, open URL, dial phone, show location, request location, or create calendar event.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
Reply,OpenUrl,DialPhone,ShowLocation,RequestLocation,CreateCalendarEvent.Reply (dict) –
A suggested reply that sends predefined text and postback data when tapped.
Text (string) – [REQUIRED]
The display text of the suggested reply. Maximum 25 characters.
PostbackData (string) – [REQUIRED]
The postback data sent to your webhook when the user taps this reply. Maximum 2048 characters.
OpenUrl (dict) –
A suggested action that opens a URL in the user’s browser or a webview.
Text (string) – [REQUIRED]
The display text of the action. Maximum 25 characters.
PostbackData (string) – [REQUIRED]
The postback data sent to your webhook when the user taps this action. Maximum 2048 characters.
Url (string) – [REQUIRED]
The URL to open. Must start with https://. Maximum 2048 characters.
Application (string) –
How to open the URL. BROWSER opens in the device’s default browser. WEBVIEW opens in an in-app webview.
WebviewViewMode (string) –
The display mode of the webview. Valid values are FULL, HALF, and TALL. Only applicable when Application is WEBVIEW.
DialPhone (dict) –
A suggested action that initiates a phone call to the specified number.
Text (string) – [REQUIRED]
The display text of the action. Maximum 25 characters.
PostbackData (string) – [REQUIRED]
The postback data sent to your webhook when the user taps this action. Maximum 2048 characters.
PhoneNumber (string) – [REQUIRED]
The phone number to dial in E.164 format.
ShowLocation (dict) –
A suggested action that shows a location on a map.
Text (string) – [REQUIRED]
The display text of the action. Maximum 25 characters.
PostbackData (string) – [REQUIRED]
The postback data sent to your webhook when the user taps this action. Maximum 2048 characters.
Latitude (float) – [REQUIRED]
The latitude of the location. Valid values are -90 to 90.
Longitude (float) – [REQUIRED]
The longitude of the location. Valid values are -180 to 180.
Label (string) –
An optional label for the location pin. Maximum 100 characters.
RequestLocation (dict) –
A suggested action that requests the user’s current location.
Text (string) – [REQUIRED]
The display text of the action. Maximum 25 characters.
PostbackData (string) – [REQUIRED]
The postback data sent to your webhook when the user taps this action. Maximum 2048 characters.
CreateCalendarEvent (dict) –
A suggested action that creates a calendar event on the user’s device.
Text (string) – [REQUIRED]
The display text of the action. Maximum 25 characters.
PostbackData (string) – [REQUIRED]
The postback data sent to your webhook when the user taps this action. Maximum 2048 characters.
Title (string) – [REQUIRED]
The title of the calendar event. Maximum 100 characters.
StartTime (datetime) – [REQUIRED]
The start time of the calendar event in ISO 8601 format.
EndTime (datetime) – [REQUIRED]
The end time of the calendar event in ISO 8601 format.
Description (string) –
An optional description for the calendar event. Maximum 500 characters.
Carousel (dict) –
A carousel of 2 to 10 scrollable cards, each with media, title, description, and suggested actions.
CardWidth (string) – [REQUIRED]
The width of cards in the carousel. Valid values are SMALL and MEDIUM.
CardContents (list) – [REQUIRED]
The list of cards in the carousel. Minimum 2, maximum 10 cards.
(dict) –
The content of a carousel card, including title, description, media, and card-level suggested actions. Media height is restricted to SHORT or MEDIUM.
Title (string) –
The title of the carousel card. Maximum 200 characters.
Description (string) –
The description text of the carousel card. Maximum 2000 characters.
Media (dict) –
The media content of the carousel card. Media height is restricted to SHORT or MEDIUM (TALL is not supported in carousels).
FileUrl (string) – [REQUIRED]
The S3 URI of the media file for the carousel card. Maximum 2000 characters.
ThumbnailUrl (string) –
The S3 URI of an optional thumbnail image for the carousel card media. Maximum 2000 characters.
Height (string) –
The display height of the media in the carousel card. Valid values are SHORT and MEDIUM.
Suggestions (list) –
Card-level suggested actions for this carousel card. Maximum 4 suggestions per card.
(dict) –
A suggested action displayed to the RCS message recipient. Can be a reply, open URL, dial phone, show location, request location, or create calendar event.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
Reply,OpenUrl,DialPhone,ShowLocation,RequestLocation,CreateCalendarEvent.Reply (dict) –
A suggested reply that sends predefined text and postback data when tapped.
Text (string) – [REQUIRED]
The display text of the suggested reply. Maximum 25 characters.
PostbackData (string) – [REQUIRED]
The postback data sent to your webhook when the user taps this reply. Maximum 2048 characters.
OpenUrl (dict) –
A suggested action that opens a URL in the user’s browser or a webview.
Text (string) – [REQUIRED]
The display text of the action. Maximum 25 characters.
PostbackData (string) – [REQUIRED]
The postback data sent to your webhook when the user taps this action. Maximum 2048 characters.
Url (string) – [REQUIRED]
The URL to open. Must start with https://. Maximum 2048 characters.
Application (string) –
How to open the URL. BROWSER opens in the device’s default browser. WEBVIEW opens in an in-app webview.
WebviewViewMode (string) –
The display mode of the webview. Valid values are FULL, HALF, and TALL. Only applicable when Application is WEBVIEW.
DialPhone (dict) –
A suggested action that initiates a phone call to the specified number.
Text (string) – [REQUIRED]
The display text of the action. Maximum 25 characters.
PostbackData (string) – [REQUIRED]
The postback data sent to your webhook when the user taps this action. Maximum 2048 characters.
PhoneNumber (string) – [REQUIRED]
The phone number to dial in E.164 format.
ShowLocation (dict) –
A suggested action that shows a location on a map.
Text (string) – [REQUIRED]
The display text of the action. Maximum 25 characters.
PostbackData (string) – [REQUIRED]
The postback data sent to your webhook when the user taps this action. Maximum 2048 characters.
Latitude (float) – [REQUIRED]
The latitude of the location. Valid values are -90 to 90.
Longitude (float) – [REQUIRED]
The longitude of the location. Valid values are -180 to 180.
Label (string) –
An optional label for the location pin. Maximum 100 characters.
RequestLocation (dict) –
A suggested action that requests the user’s current location.
Text (string) – [REQUIRED]
The display text of the action. Maximum 25 characters.
PostbackData (string) – [REQUIRED]
The postback data sent to your webhook when the user taps this action. Maximum 2048 characters.
CreateCalendarEvent (dict) –
A suggested action that creates a calendar event on the user’s device.
Text (string) – [REQUIRED]
The display text of the action. Maximum 25 characters.
PostbackData (string) – [REQUIRED]
The postback data sent to your webhook when the user taps this action. Maximum 2048 characters.
Title (string) – [REQUIRED]
The title of the calendar event. Maximum 100 characters.
StartTime (datetime) – [REQUIRED]
The start time of the calendar event in ISO 8601 format.
EndTime (datetime) – [REQUIRED]
The end time of the calendar event in ISO 8601 format.
Description (string) –
An optional description for the calendar event. Maximum 500 characters.
Suggestions (list) –
Message-level suggested actions displayed to the recipient. Maximum 11 suggestions per message.
(dict) –
A suggested action displayed to the RCS message recipient. Can be a reply, open URL, dial phone, show location, request location, or create calendar event.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
Reply,OpenUrl,DialPhone,ShowLocation,RequestLocation,CreateCalendarEvent.Reply (dict) –
A suggested reply that sends predefined text and postback data when tapped.
Text (string) – [REQUIRED]
The display text of the suggested reply. Maximum 25 characters.
PostbackData (string) – [REQUIRED]
The postback data sent to your webhook when the user taps this reply. Maximum 2048 characters.
OpenUrl (dict) –
A suggested action that opens a URL in the user’s browser or a webview.
Text (string) – [REQUIRED]
The display text of the action. Maximum 25 characters.
PostbackData (string) – [REQUIRED]
The postback data sent to your webhook when the user taps this action. Maximum 2048 characters.
Url (string) – [REQUIRED]
The URL to open. Must start with https://. Maximum 2048 characters.
Application (string) –
How to open the URL. BROWSER opens in the device’s default browser. WEBVIEW opens in an in-app webview.
WebviewViewMode (string) –
The display mode of the webview. Valid values are FULL, HALF, and TALL. Only applicable when Application is WEBVIEW.
DialPhone (dict) –
A suggested action that initiates a phone call to the specified number.
Text (string) – [REQUIRED]
The display text of the action. Maximum 25 characters.
PostbackData (string) – [REQUIRED]
The postback data sent to your webhook when the user taps this action. Maximum 2048 characters.
PhoneNumber (string) – [REQUIRED]
The phone number to dial in E.164 format.
ShowLocation (dict) –
A suggested action that shows a location on a map.
Text (string) – [REQUIRED]
The display text of the action. Maximum 25 characters.
PostbackData (string) – [REQUIRED]
The postback data sent to your webhook when the user taps this action. Maximum 2048 characters.
Latitude (float) – [REQUIRED]
The latitude of the location. Valid values are -90 to 90.
Longitude (float) – [REQUIRED]
The longitude of the location. Valid values are -180 to 180.
Label (string) –
An optional label for the location pin. Maximum 100 characters.
RequestLocation (dict) –
A suggested action that requests the user’s current location.
Text (string) – [REQUIRED]
The display text of the action. Maximum 25 characters.
PostbackData (string) – [REQUIRED]
The postback data sent to your webhook when the user taps this action. Maximum 2048 characters.
CreateCalendarEvent (dict) –
A suggested action that creates a calendar event on the user’s device.
Text (string) – [REQUIRED]
The display text of the action. Maximum 25 characters.
PostbackData (string) – [REQUIRED]
The postback data sent to your webhook when the user taps this action. Maximum 2048 characters.
Title (string) – [REQUIRED]
The title of the calendar event. Maximum 100 characters.
StartTime (datetime) – [REQUIRED]
The start time of the calendar event in ISO 8601 format.
EndTime (datetime) – [REQUIRED]
The end time of the calendar event in ISO 8601 format.
Description (string) –
An optional description for the calendar event. Maximum 500 characters.
TimeToLive (integer) – The duration in seconds that the RCS message is valid for delivery. If the message cannot be delivered within this duration, it is considered expired. Valid values are 1 to 172800 (48 hours). If a FallbackConfiguration is provided, the fallback is triggered when the duration expires without delivery confirmation.
MessageTrafficType (string) – The traffic type of the RCS message. Valid values are AUTHENTICATION, TRANSACTION, PROMOTION, SERVICE_REQUEST, and ACKNOWLEDGEMENT. This field is reserved for future use.
FallbackConfiguration (dict) –
Configuration for SMS or MMS fallback when RCS delivery fails. If provided, the service sends a fallback message via the specified channel when the RCS message fails or the TimeToLive expires.
Channel (string) – [REQUIRED]
The fallback channel to use when RCS delivery fails. Valid values are SMS and MMS. SMS and MMS are mutually exclusive.
MessageBody (string) –
The text body of the fallback message. Required for SMS fallback. For MMS fallback, at least one of MessageBody or MediaUrls must be provided.
MediaUrls (list) –
An array of S3 URIs to media files for MMS fallback. Only valid when Channel is MMS.
(string) –
OriginationIdentity (string) –
The origination identity to use for the fallback message. This can be a PhoneNumber, PhoneNumberId, PhoneNumberArn, SenderId, or SenderIdArn. Pool IDs and pool ARNs are not accepted. If not specified and the original message was sent via a pool, the service selects a suitable number from the pool.
ProtectConfigurationId (string) – The unique identifier of the protect configuration to use.
ConfigurationSetName (string) – The name of the configuration set to use. This can be either the ConfigurationSetName or ConfigurationSetArn.
MaxPrice (string) – The maximum amount that you want to spend, in US dollars, per each RCS message.
DryRun (boolean) – When set to true, the message is checked and validated, but isn’t sent to the end recipient.
Context (dict) –
You can specify custom data in this field. If you do, that data is logged to the event destination.
(string) –
(string) –
MessageFeedbackEnabled (boolean) – Set to true to enable message feedback for the message. When a user receives the message you need to update the message status using PutMessageFeedback.
- Return type:
dict
- Returns:
Response Syntax
{ 'MessageId': 'string' }
Response Structure
(dict) –
MessageId (string) –
The unique identifier for the message.
Exceptions