sendRcsMessage method
- required String destinationPhoneNumber,
- required String originationIdentity,
- String? configurationSetName,
- Map<
String, String> ? context, - bool? dryRun,
- RcsFallbackConfiguration? fallbackConfiguration,
- String? maxPrice,
- bool? messageFeedbackEnabled,
- String? messageTrafficType,
- String? protectConfigurationId,
- RcsMessageContent? rcsMessageContent,
- int? timeToLive,
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.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter destinationPhoneNumber :
The destination phone number in E.164 format.
Parameter originationIdentity :
The origination identity of the message. This can be either the
RcsAgentId, RcsAgentArn, PoolId, or PoolArn.
Parameter configurationSetName :
The name of the configuration set to use. This can be either the
ConfigurationSetName or ConfigurationSetArn.
Parameter context :
You can specify custom data in this field. If you do, that data is logged
to the event destination.
Parameter dryRun :
When set to true, the message is checked and validated, but isn't sent to
the end recipient.
Parameter fallbackConfiguration :
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.
Parameter maxPrice :
The maximum amount that you want to spend, in US dollars, per each RCS
message.
Parameter messageFeedbackEnabled :
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.
Parameter messageTrafficType :
The traffic type of the RCS message. Valid values are AUTHENTICATION,
TRANSACTION, PROMOTION, SERVICE_REQUEST, and ACKNOWLEDGEMENT. This field
is reserved for future use.
Parameter protectConfigurationId :
The unique identifier of the protect configuration to use.
Parameter rcsMessageContent :
The content of the RCS message. Contains the message content (text, file,
rich card, or carousel) and optional message-level suggested actions.
Parameter timeToLive :
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.
Implementation
Future<SendRcsMessageResult> sendRcsMessage({
required String destinationPhoneNumber,
required String originationIdentity,
String? configurationSetName,
Map<String, String>? context,
bool? dryRun,
RcsFallbackConfiguration? fallbackConfiguration,
String? maxPrice,
bool? messageFeedbackEnabled,
String? messageTrafficType,
String? protectConfigurationId,
RcsMessageContent? rcsMessageContent,
int? timeToLive,
}) async {
_s.validateNumRange(
'timeToLive',
timeToLive,
1,
172800,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'PinpointSMSVoiceV2.SendRcsMessage'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'DestinationPhoneNumber': destinationPhoneNumber,
'OriginationIdentity': originationIdentity,
if (configurationSetName != null)
'ConfigurationSetName': configurationSetName,
if (context != null) 'Context': context,
if (dryRun != null) 'DryRun': dryRun,
if (fallbackConfiguration != null)
'FallbackConfiguration': fallbackConfiguration,
if (maxPrice != null) 'MaxPrice': maxPrice,
if (messageFeedbackEnabled != null)
'MessageFeedbackEnabled': messageFeedbackEnabled,
if (messageTrafficType != null)
'MessageTrafficType': messageTrafficType,
if (protectConfigurationId != null)
'ProtectConfigurationId': protectConfigurationId,
if (rcsMessageContent != null) 'RcsMessageContent': rcsMessageContent,
if (timeToLive != null) 'TimeToLive': timeToLive,
},
);
return SendRcsMessageResult.fromJson(jsonResponse.body);
}