createNotifyConfiguration method

Future<CreateNotifyConfigurationResult> createNotifyConfiguration({
  1. required String displayName,
  2. required List<NumberCapability> enabledChannels,
  3. required NotifyConfigurationUseCase useCase,
  4. String? clientToken,
  5. String? defaultTemplateId,
  6. bool? deletionProtectionEnabled,
  7. List<String>? enabledCountries,
  8. String? poolId,
  9. List<Tag>? tags,
})

Creates a new notify configuration for managed messaging. A notify configuration defines the settings for sending templated messages, including the display name, use case, enabled channels, and enabled countries.

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

Parameter displayName : The display name to associate with the notify configuration.

Parameter enabledChannels : An array of channels to enable for the notify configuration. Supported values include SMS and VOICE.

Parameter useCase : The use case for the notify configuration.

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 defaultTemplateId : The default template identifier to associate with the notify configuration. If specified, this template is used when sending messages without an explicit template identifier.

Parameter deletionProtectionEnabled : By default this is set to false. When set to true the notify configuration can't be deleted. You can change this value using the UpdateNotifyConfiguration action.

Parameter enabledCountries : An array of two-character ISO country codes, in ISO 3166-1 alpha-2 format, that are enabled for the notify configuration.

Parameter poolId : The identifier of the pool to associate with the notify configuration.

Parameter tags : An array of tags (key and value pairs) associated with the notify configuration.

Implementation

Future<CreateNotifyConfigurationResult> createNotifyConfiguration({
  required String displayName,
  required List<NumberCapability> enabledChannels,
  required NotifyConfigurationUseCase useCase,
  String? clientToken,
  String? defaultTemplateId,
  bool? deletionProtectionEnabled,
  List<String>? enabledCountries,
  String? poolId,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'PinpointSMSVoiceV2.CreateNotifyConfiguration'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DisplayName': displayName,
      'EnabledChannels': enabledChannels.map((e) => e.value).toList(),
      'UseCase': useCase.value,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (defaultTemplateId != null) 'DefaultTemplateId': defaultTemplateId,
      if (deletionProtectionEnabled != null)
        'DeletionProtectionEnabled': deletionProtectionEnabled,
      if (enabledCountries != null) 'EnabledCountries': enabledCountries,
      if (poolId != null) 'PoolId': poolId,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateNotifyConfigurationResult.fromJson(jsonResponse.body);
}