createVerifiedDestinationNumber method

Future<CreateVerifiedDestinationNumberResult> createVerifiedDestinationNumber({
  1. required String destinationPhoneNumber,
  2. String? clientToken,
  3. String? rcsAgentId,
  4. List<Tag>? tags,
})

You can only send messages to verified destination numbers when your account is in the sandbox. You can add up to 10 verified destination numbers.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter destinationPhoneNumber : The verified destination phone number, in E.164 format.

Parameter clientToken : Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you don't specify a client token, a randomly generated token is used for the request to ensure idempotency.

Parameter rcsAgentId : The unique identifier of the RCS agent to associate with the verified destination number. You can use either the RcsAgentId or RcsAgentArn.

Parameter tags : An array of tags (key and value pairs) to associate with the destination number.

Implementation

Future<CreateVerifiedDestinationNumberResult>
    createVerifiedDestinationNumber({
  required String destinationPhoneNumber,
  String? clientToken,
  String? rcsAgentId,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'PinpointSMSVoiceV2.CreateVerifiedDestinationNumber'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DestinationPhoneNumber': destinationPhoneNumber,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (rcsAgentId != null) 'RcsAgentId': rcsAgentId,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateVerifiedDestinationNumberResult.fromJson(jsonResponse.body);
}