requestSenderId method
Request a new sender ID that doesn't require registration.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter isoCountryCode :
The two-character code, in ISO 3166-1 alpha-2 format, for the country or
region.
Parameter senderId :
The sender ID string to request. The sender ID can be 1-11 alphanumeric
characters including letters (A-Z, a-z), numbers (0-9), or hyphens (-).
The sender ID must contain at least one letter and cannot start or end
with a hyphen.
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 deletionProtectionEnabled :
By default this is set to false. When set to true the sender ID can't be
deleted.
Parameter messageTypes :
The type of message. Valid values are TRANSACTIONAL for messages that are
critical or time-sensitive and PROMOTIONAL for messages that aren't
critical or time-sensitive.
Parameter tags :
An array of tags (key and value pairs) to associate with the sender ID.
Implementation
Future<RequestSenderIdResult> requestSenderId({
required String isoCountryCode,
required String senderId,
String? clientToken,
bool? deletionProtectionEnabled,
List<MessageType>? messageTypes,
List<Tag>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'PinpointSMSVoiceV2.RequestSenderId'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'IsoCountryCode': isoCountryCode,
'SenderId': senderId,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
if (deletionProtectionEnabled != null)
'DeletionProtectionEnabled': deletionProtectionEnabled,
if (messageTypes != null)
'MessageTypes': messageTypes.map((e) => e.value).toList(),
if (tags != null) 'Tags': tags,
},
);
return RequestSenderIdResult.fromJson(jsonResponse.body);
}