sendVoiceMessage method

Future<SendVoiceMessageResponse> sendVoiceMessage({
  1. String? callerId,
  2. String? configurationSetName,
  3. VoiceMessageContent? content,
  4. String? destinationPhoneNumber,
  5. String? originationPhoneNumber,
})

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

May throw TooManyRequestsException. May throw BadRequestException. May throw InternalServiceErrorException.

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

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

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

Parameter originationPhoneNumber : 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.

Implementation

Future<SendVoiceMessageResponse> sendVoiceMessage({
  String? callerId,
  String? configurationSetName,
  VoiceMessageContent? content,
  String? destinationPhoneNumber,
  String? originationPhoneNumber,
}) async {
  final $payload = <String, dynamic>{
    if (callerId != null) 'CallerId': callerId,
    if (configurationSetName != null)
      'ConfigurationSetName': configurationSetName,
    if (content != null) 'Content': content,
    if (destinationPhoneNumber != null)
      'DestinationPhoneNumber': destinationPhoneNumber,
    if (originationPhoneNumber != null)
      'OriginationPhoneNumber': originationPhoneNumber,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v1/sms-voice/voice/message',
    exceptionFnMap: _exceptionFns,
  );
  return SendVoiceMessageResponse.fromJson(response);
}