createVoiceTemplate method

Future<CreateVoiceTemplateResponse> createVoiceTemplate({
  1. required String templateName,
  2. required VoiceTemplateRequest voiceTemplateRequest,
})

Creates a message template for messages that are sent through the voice channel.

May throw MethodNotAllowedException. May throw TooManyRequestsException. May throw BadRequestException. May throw InternalServerErrorException. May throw ForbiddenException.

Parameter templateName : The name of the message template. A template name must start with an alphanumeric character and can contain a maximum of 128 characters. The characters can be alphanumeric characters, underscores (_), or hyphens (-). Template names are case sensitive.

Implementation

Future<CreateVoiceTemplateResponse> createVoiceTemplate({
  required String templateName,
  required VoiceTemplateRequest voiceTemplateRequest,
}) async {
  ArgumentError.checkNotNull(templateName, 'templateName');
  ArgumentError.checkNotNull(voiceTemplateRequest, 'voiceTemplateRequest');
  final response = await _protocol.sendRaw(
    payload: voiceTemplateRequest,
    method: 'POST',
    requestUri: '/v1/templates/${Uri.encodeComponent(templateName)}/voice',
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return CreateVoiceTemplateResponse(
    createTemplateMessageBody: CreateTemplateMessageBody.fromJson($json),
  );
}