createOptOutList method
Creates a new opt-out list.
If the opt-out list name already exists, an error is returned.
An opt-out list is a list of phone numbers that are opted out, meaning you can't send SMS or voice messages to them. If end user replies with the keyword "STOP," an entry for the phone number is added to the opt-out list. In addition to STOP, your recipients can use any supported opt-out keyword, such as CANCEL or OPTOUT. For a list of supported opt-out keywords, see SMS opt out in the End User Messaging SMS User Guide.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter optOutListName :
The name of the new OptOutList.
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 tags :
An array of tags (key and value pairs) to associate with the new
OptOutList.
Implementation
Future<CreateOptOutListResult> createOptOutList({
required String optOutListName,
String? clientToken,
List<Tag>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'PinpointSMSVoiceV2.CreateOptOutList'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'OptOutListName': optOutListName,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
if (tags != null) 'Tags': tags,
},
);
return CreateOptOutListResult.fromJson(jsonResponse.body);
}