Skip to content

send_voice_message async

send_voice_message(
    *,
    config_overrides: Optional[AsyncPinpointSMSVoiceClientConfig] = None,
    caller_id: Optional[String] = None,
    configuration_set_name: Optional[WordCharactersWithDelimiters] = None,
    content: Optional[VoiceMessageContent] = None,
    destination_phone_number: Optional[NonEmptyString] = None,
    origination_phone_number: Optional[NonEmptyString] = None,
) -> SendVoiceMessageResponse

Create a new voice message and send it to a recipient's phone number.

Parameters:

  • caller_id (Optional[String], default: None ) –

    The phone number that appears on recipients' devices when they receive the message.

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

    The name of the configuration set that you want to use to send the message.

  • destination_phone_number (Optional[NonEmptyString], default: None ) –

    The phone number that you want to send the voice message to.

  • origination_phone_number (Optional[NonEmptyString], default: None ) –

    The phone number that Amazon Pinpoint should use to send the voice message. This isn't necessarily the phone number that appears on recipients' devices when they receive the message, because you can specify a CallerId parameter in the request.

Raises:

Source code in docs_src/capo_pinpoint_sms_voice/_services/async_pinpoint_sms_voice.py
async def send_voice_message(
    self,
    *,
    config_overrides: Optional[AsyncPinpointSMSVoiceClientConfig] = None,
    caller_id: Optional["capo_pinpoint_sms_voice.types.string.String"] = None,
    configuration_set_name: Optional[
        "capo_pinpoint_sms_voice.types.word_characters_with_delimiters.WordCharactersWithDelimiters"
    ] = None,
    content: Optional[
        "capo_pinpoint_sms_voice.types.voice_message_content.VoiceMessageContent"
    ] = None,
    destination_phone_number: Optional[
        "capo_pinpoint_sms_voice.types.non_empty_string.NonEmptyString"
    ] = None,
    origination_phone_number: Optional[
        "capo_pinpoint_sms_voice.types.non_empty_string.NonEmptyString"
    ] = None,
) -> "capo_pinpoint_sms_voice.types.send_voice_message_response.SendVoiceMessageResponse":
    """Create a new voice message and send it to a recipient's phone number.

    Args:
        caller_id: The phone number that appears on recipients' devices when they receive the message.
        configuration_set_name: The name of the configuration set that you want to use to send the message.
        destination_phone_number: The phone number that you want to send the voice message to.
        origination_phone_number: The phone number that Amazon Pinpoint should use to send the voice message. This isn't necessarily the phone number that appears on recipients' devices when they receive the message, because you can specify a CallerId parameter in the request.

    Raises:
        capo_pinpoint_sms_voice.errors.bad_request_exception.BadRequestException: The input you provided is invalid.
        capo_pinpoint_sms_voice.errors.internal_service_error_exception.InternalServiceErrorException: 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.
        capo_pinpoint_sms_voice.errors.too_many_requests_exception.TooManyRequestsException: You've issued too many requests to the resource. Wait a few minutes, and then try again.
        capo_pinpoint_sms_voice.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_pinpoint_sms_voice.types.send_voice_message_request.SendVoiceMessageRequest]",
    ) -> AsyncOperationResponse[
        "capo_pinpoint_sms_voice.types.send_voice_message_response.SendVoiceMessageResponse"
    ]:
        import capo_pinpoint_sms_voice._operations.pinpoint_sms_voice.send_voice_message

        (
            output,
            http_response,
        ) = await capo_pinpoint_sms_voice._operations.pinpoint_sms_voice.send_voice_message.async_send_voice_message(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SendVoiceMessage")
    )
    input_: capo_pinpoint_sms_voice.types.send_voice_message_request.SendVoiceMessageRequest = {}
    if caller_id is not None:
        input_["caller_id"] = caller_id
    if configuration_set_name is not None:
        input_["configuration_set_name"] = configuration_set_name
    if content is not None:
        input_["content"] = content
    if destination_phone_number is not None:
        input_["destination_phone_number"] = destination_phone_number
    if origination_phone_number is not None:
        input_["origination_phone_number"] = origination_phone_number

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