Skip to content

send_rcs_message async

send_rcs_message(
    destination_phone_number: PhoneNumber,
    origination_identity: RcsMessageOriginationIdentity,
    *,
    config_overrides: Optional[AsyncPinpointSMSVoiceV2ClientConfig] = None,
    rcs_message_content: Optional[RcsMessageContent] = None,
    time_to_live: Optional[RcsTimeToLive] = None,
    message_traffic_type: Optional[RcsMessageTrafficType] = None,
    fallback_configuration: Optional[RcsFallbackConfiguration] = None,
    protect_configuration_id: Optional[ProtectConfigurationIdOrArn] = None,
    configuration_set_name: Optional[ConfigurationSetNameOrArn] = None,
    max_price: Optional[MaxPrice] = None,
    dry_run: Optional[bool] = None,
    context: Optional[ContextMap] = None,
    message_feedback_enabled: Optional[bool] = None,
) -> SendRcsMessageResult

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.

Parameters:

  • destination_phone_number (PhoneNumber) –

    The destination phone number in E.164 format.

  • origination_identity (RcsMessageOriginationIdentity) –

    The origination identity of the message. This can be either the RcsAgentId, RcsAgentArn, PoolId, or PoolArn.

  • rcs_message_content (Optional[RcsMessageContent], default: None ) –

    The content of the RCS message. Contains the message content (text, file, rich card, or carousel) and optional message-level suggested actions.

  • time_to_live (Optional[RcsTimeToLive], default: None ) –

    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.

  • message_traffic_type (Optional[RcsMessageTrafficType], default: None ) –

    The traffic type of the RCS message. Valid values are AUTHENTICATION, TRANSACTION, PROMOTION, SERVICE_REQUEST, and ACKNOWLEDGEMENT. This field is reserved for future use.

  • fallback_configuration (Optional[RcsFallbackConfiguration], default: None ) –

    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.

  • protect_configuration_id (Optional[ProtectConfigurationIdOrArn], default: None ) –

    The unique identifier of the protect configuration to use.

  • configuration_set_name (Optional[ConfigurationSetNameOrArn], default: None ) –

    The name of the configuration set to use. This can be either the ConfigurationSetName or ConfigurationSetArn.

  • max_price (Optional[MaxPrice], default: None ) –

    The maximum amount that you want to spend, in US dollars, per each RCS message.

  • dry_run (Optional[bool], default: None ) –

    When set to true, the message is checked and validated, but isn't sent to the end recipient.

  • context (Optional[ContextMap], default: None ) –

    You can specify custom data in this field. If you do, that data is logged to the event destination.

  • message_feedback_enabled (Optional[bool], default: None ) –

    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.

Raises:

  • AccessDeniedException –

    The request was denied because you don't have sufficient permissions to access the resource.

  • ConflictException –

    Your request has conflicting operations. This can occur if you're trying to perform more than one operation on the same resource at the same time or it could be that the requested action isn't valid for the current state or configuration of the resource.

  • InternalServerException –

    The API encountered an unexpected error and couldn't complete the request. You might be able to successfully issue the request again in the future.

  • ResourceNotFoundException –

    A requested resource couldn't be found.

  • ServiceQuotaExceededException –

    The request would cause a service quota to be exceeded.

  • ThrottlingException –

    An error that occurred because too many requests were sent during a certain amount of time.

  • ValidationException –

    A validation exception for a field.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_pinpoint_sms_voice_v2/_services/async_pinpoint_sms_voice_v2.py
async def send_rcs_message(
    self,
    destination_phone_number: "capo_pinpoint_sms_voice_v2.types.phone_number.PhoneNumber",
    origination_identity: "capo_pinpoint_sms_voice_v2.types.rcs_message_origination_identity.RcsMessageOriginationIdentity",
    *,
    config_overrides: Optional[AsyncPinpointSMSVoiceV2ClientConfig] = None,
    rcs_message_content: Optional[
        "capo_pinpoint_sms_voice_v2.types.rcs_message_content.RcsMessageContent"
    ] = None,
    time_to_live: Optional[
        "capo_pinpoint_sms_voice_v2.types.rcs_time_to_live.RcsTimeToLive"
    ] = None,
    message_traffic_type: Optional[
        "capo_pinpoint_sms_voice_v2.types.rcs_message_traffic_type.RcsMessageTrafficType"
    ] = None,
    fallback_configuration: Optional[
        "capo_pinpoint_sms_voice_v2.types.rcs_fallback_configuration.RcsFallbackConfiguration"
    ] = None,
    protect_configuration_id: Optional[
        "capo_pinpoint_sms_voice_v2.types.protect_configuration_id_or_arn.ProtectConfigurationIdOrArn"
    ] = None,
    configuration_set_name: Optional[
        "capo_pinpoint_sms_voice_v2.types.configuration_set_name_or_arn.ConfigurationSetNameOrArn"
    ] = None,
    max_price: Optional[
        "capo_pinpoint_sms_voice_v2.types.max_price.MaxPrice"
    ] = None,
    dry_run: Optional[bool] = None,
    context: Optional[
        "capo_pinpoint_sms_voice_v2.types.context_map.ContextMap"
    ] = None,
    message_feedback_enabled: Optional[bool] = None,
) -> (
    "capo_pinpoint_sms_voice_v2.types.send_rcs_message_result.SendRcsMessageResult"
):
    """<p>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.</p>

    Args:
        destination_phone_number: <p>The destination phone number in E.164 format.</p>
        origination_identity: <p>The origination identity of the message. This can be either the RcsAgentId, RcsAgentArn, PoolId, or PoolArn.</p>
        rcs_message_content: <p>The content of the RCS message. Contains the message content (text, file, rich card, or carousel) and optional message-level suggested actions.</p>
        time_to_live: <p>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.</p>
        message_traffic_type: <p>The traffic type of the RCS message. Valid values are AUTHENTICATION, TRANSACTION, PROMOTION, SERVICE_REQUEST, and ACKNOWLEDGEMENT. This field is reserved for future use.</p>
        fallback_configuration: <p>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.</p>
        protect_configuration_id: <p>The unique identifier of the protect configuration to use.</p>
        configuration_set_name: <p>The name of the configuration set to use. This can be either the ConfigurationSetName or ConfigurationSetArn.</p>
        max_price: <p>The maximum amount that you want to spend, in US dollars, per each RCS message.</p>
        dry_run: <p>When set to true, the message is checked and validated, but isn't sent to the end recipient.</p>
        context: <p>You can specify custom data in this field. If you do, that data is logged to the event destination.</p>
        message_feedback_enabled: <p>Set to true to enable message feedback for the message. When a user receives the message you need to update the message status using <a>PutMessageFeedback</a>.</p>

    Raises:
        capo_pinpoint_sms_voice_v2.errors.access_denied_exception.AccessDeniedException: <p>The request was denied because you don't have sufficient permissions to access the resource.</p>
        capo_pinpoint_sms_voice_v2.errors.conflict_exception.ConflictException: <p>Your request has conflicting operations. This can occur if you're trying to perform more than one operation on the same resource at the same time or it could be that the requested action isn't valid for the current state or configuration of the resource.</p>
        capo_pinpoint_sms_voice_v2.errors.internal_server_exception.InternalServerException: <p>The API encountered an unexpected error and couldn't complete the request. You might be able to successfully issue the request again in the future.</p>
        capo_pinpoint_sms_voice_v2.errors.resource_not_found_exception.ResourceNotFoundException: <p>A requested resource couldn't be found.</p>
        capo_pinpoint_sms_voice_v2.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would cause a service quota to be exceeded.</p>
        capo_pinpoint_sms_voice_v2.errors.throttling_exception.ThrottlingException: <p>An error that occurred because too many requests were sent during a certain amount of time.</p>
        capo_pinpoint_sms_voice_v2.errors.validation_exception.ValidationException: <p>A validation exception for a field.</p>
        capo_pinpoint_sms_voice_v2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_pinpoint_sms_voice_v2.types.send_rcs_message_request.SendRcsMessageRequest]",
    ) -> AsyncOperationResponse[
        "capo_pinpoint_sms_voice_v2.types.send_rcs_message_result.SendRcsMessageResult"
    ]:
        import capo_pinpoint_sms_voice_v2._operations.pinpoint_sms_voice_v2.send_rcs_message

        (
            output,
            http_response,
        ) = await capo_pinpoint_sms_voice_v2._operations.pinpoint_sms_voice_v2.send_rcs_message.async_send_rcs_message(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SendRcsMessage")
    )
    input_: capo_pinpoint_sms_voice_v2.types.send_rcs_message_request.SendRcsMessageRequest = {
        "destination_phone_number": destination_phone_number,
        "origination_identity": origination_identity,
    }
    if rcs_message_content is not None:
        input_["rcs_message_content"] = rcs_message_content
    if time_to_live is not None:
        input_["time_to_live"] = time_to_live
    if message_traffic_type is not None:
        input_["message_traffic_type"] = message_traffic_type
    if fallback_configuration is not None:
        input_["fallback_configuration"] = fallback_configuration
    if protect_configuration_id is not None:
        input_["protect_configuration_id"] = protect_configuration_id
    if configuration_set_name is not None:
        input_["configuration_set_name"] = configuration_set_name
    if max_price is not None:
        input_["max_price"] = max_price
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if context is not None:
        input_["context"] = context
    if message_feedback_enabled is not None:
        input_["message_feedback_enabled"] = message_feedback_enabled

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output