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/pinpoint_sms_voice.py
| def send_voice_message(
self,
*,
config_overrides: Optional[PinpointSMSVoiceClientConfig] = 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.
"""
def _handler(
req: "OperationRequest[capo_pinpoint_sms_voice.types.send_voice_message_request.SendVoiceMessageRequest]",
) -> OperationResponse[
"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 = (
capo_pinpoint_sms_voice._operations.pinpoint_sms_voice.send_voice_message.send_voice_message(
req.options, req.input
)
)
return OperationResponse(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 = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|