Skip to content

create_notify_configuration async

create_notify_configuration(
    display_name: NotifyConfigurationDisplayName,
    use_case: NotifyConfigurationUseCase,
    enabled_channels: NotifyEnabledChannelsList,
    *,
    config_overrides: Optional[AsyncPinpointSMSVoiceV2ClientConfig] = None,
    default_template_id: Optional[NotifyTemplateId] = None,
    pool_id: Optional[PoolIdOrArn] = None,
    enabled_countries: Optional[IsoCountryCodeList] = None,
    deletion_protection_enabled: Optional[bool] = None,
    client_token: Optional[ClientToken] = None,
    tags: Optional[TagList] = None,
) -> CreateNotifyConfigurationResult

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.

Parameters:

  • display_name (NotifyConfigurationDisplayName) –

    The display name to associate with the notify configuration.

  • use_case (NotifyConfigurationUseCase) –

    The use case for the notify configuration.

  • default_template_id (Optional[NotifyTemplateId], default: None ) –

    The default template identifier to associate with the notify configuration. If specified, this template is used when sending messages without an explicit template identifier.

  • pool_id (Optional[PoolIdOrArn], default: None ) –

    The identifier of the pool to associate with the notify configuration.

  • enabled_countries (Optional[IsoCountryCodeList], default: None ) –

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

  • enabled_channels (NotifyEnabledChannelsList) –

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

  • deletion_protection_enabled (Optional[bool], default: None ) –

    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.

  • client_token (Optional[ClientToken], default: None ) –

    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.

  • tags (Optional[TagList], default: None ) –

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

Raises:

  • AccessDeniedException –

    The request was denied because you don't have sufficient permissions to access the resource.

  • ConflictException –

    Your request has conflicting operations. This can occur if you're trying to perform more than one operation on the same resource at the same time or it could be that the requested action isn't valid for the current state or configuration of the resource.

  • InternalServerException –

    The API encountered an unexpected error and couldn't complete the request. You might be able to successfully issue the request again in the future.

  • ResourceNotFoundException –

    A requested resource couldn't be found.

  • ServiceQuotaExceededException –

    The request would cause a service quota to be exceeded.

  • ThrottlingException –

    An error that occurred because too many requests were sent during a certain amount of time.

  • ValidationException –

    A validation exception for a field.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

CreateNotifyConfiguration Create a notify configuration for OTP code verification over SMS.

>>> await client.create_notify_configuration(display_name='MyOTPConfig', use_case='CODE_VERIFICATION', enabled_channels=['SMS'], enabled_countries=['US', 'CA'], deletion_protection_enabled=False, tags=[{'Key': 'Environment', 'Value': 'Production'}])
Source code in docs_src/capo_pinpoint_sms_voice_v2/_services/async_pinpoint_sms_voice_v2.py
async def create_notify_configuration(
    self,
    display_name: "capo_pinpoint_sms_voice_v2.types.notify_configuration_display_name.NotifyConfigurationDisplayName",
    use_case: "capo_pinpoint_sms_voice_v2.types.notify_configuration_use_case.NotifyConfigurationUseCase",
    enabled_channels: "capo_pinpoint_sms_voice_v2.types.notify_enabled_channels_list.NotifyEnabledChannelsList",
    *,
    config_overrides: Optional[AsyncPinpointSMSVoiceV2ClientConfig] = None,
    default_template_id: Optional[
        "capo_pinpoint_sms_voice_v2.types.notify_template_id.NotifyTemplateId"
    ] = None,
    pool_id: Optional[
        "capo_pinpoint_sms_voice_v2.types.pool_id_or_arn.PoolIdOrArn"
    ] = None,
    enabled_countries: Optional[
        "capo_pinpoint_sms_voice_v2.types.iso_country_code_list.IsoCountryCodeList"
    ] = None,
    deletion_protection_enabled: Optional[bool] = None,
    client_token: Optional[
        "capo_pinpoint_sms_voice_v2.types.client_token.ClientToken"
    ] = None,
    tags: Optional["capo_pinpoint_sms_voice_v2.types.tag_list.TagList"] = None,
) -> "capo_pinpoint_sms_voice_v2.types.create_notify_configuration_result.CreateNotifyConfigurationResult":
    """<p>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.</p>

    Args:
        display_name: <p>The display name to associate with the notify configuration.</p>
        use_case: <p>The use case for the notify configuration.</p>
        default_template_id: <p>The default template identifier to associate with the notify configuration. If specified, this template is used when sending messages without an explicit template identifier.</p>
        pool_id: <p>The identifier of the pool to associate with the notify configuration.</p>
        enabled_countries: <p>An array of two-character ISO country codes, in ISO 3166-1 alpha-2 format, that are enabled for the notify configuration.</p>
        enabled_channels: <p>An array of channels to enable for the notify configuration. Supported values include <code>SMS</code> and <code>VOICE</code>.</p>
        deletion_protection_enabled: <p>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 <a>UpdateNotifyConfiguration</a> action.</p>
        client_token: <p>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.</p>
        tags: <p>An array of tags (key and value pairs) associated with the notify configuration.</p>

    Raises:
        capo_pinpoint_sms_voice_v2.errors.access_denied_exception.AccessDeniedException: <p>The request was denied because you don't have sufficient permissions to access the resource.</p>
        capo_pinpoint_sms_voice_v2.errors.conflict_exception.ConflictException: <p>Your request has conflicting operations. This can occur if you're trying to perform more than one operation on the same resource at the same time or it could be that the requested action isn't valid for the current state or configuration of the resource.</p>
        capo_pinpoint_sms_voice_v2.errors.internal_server_exception.InternalServerException: <p>The API encountered an unexpected error and couldn't complete the request. You might be able to successfully issue the request again in the future.</p>
        capo_pinpoint_sms_voice_v2.errors.resource_not_found_exception.ResourceNotFoundException: <p>A requested resource couldn't be found.</p>
        capo_pinpoint_sms_voice_v2.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would cause a service quota to be exceeded.</p>
        capo_pinpoint_sms_voice_v2.errors.throttling_exception.ThrottlingException: <p>An error that occurred because too many requests were sent during a certain amount of time.</p>
        capo_pinpoint_sms_voice_v2.errors.validation_exception.ValidationException: <p>A validation exception for a field.</p>
        capo_pinpoint_sms_voice_v2.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        CreateNotifyConfiguration
        Create a notify configuration for OTP code verification over SMS.

        >>> await client.create_notify_configuration(display_name='MyOTPConfig', use_case='CODE_VERIFICATION', enabled_channels=['SMS'], enabled_countries=['US', 'CA'], deletion_protection_enabled=False, tags=[{'Key': 'Environment', 'Value': 'Production'}])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_pinpoint_sms_voice_v2.types.create_notify_configuration_request.CreateNotifyConfigurationRequest]",
    ) -> AsyncOperationResponse[
        "capo_pinpoint_sms_voice_v2.types.create_notify_configuration_result.CreateNotifyConfigurationResult"
    ]:
        import capo_pinpoint_sms_voice_v2._operations.pinpoint_sms_voice_v2.create_notify_configuration

        (
            output,
            http_response,
        ) = await capo_pinpoint_sms_voice_v2._operations.pinpoint_sms_voice_v2.create_notify_configuration.async_create_notify_configuration(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateNotifyConfiguration")
    )
    input_: capo_pinpoint_sms_voice_v2.types.create_notify_configuration_request.CreateNotifyConfigurationRequest = {
        "display_name": display_name,
        "use_case": use_case,
        "enabled_channels": enabled_channels,
    }
    if default_template_id is not None:
        input_["default_template_id"] = default_template_id
    if pool_id is not None:
        input_["pool_id"] = pool_id
    if enabled_countries is not None:
        input_["enabled_countries"] = enabled_countries
    if deletion_protection_enabled is not None:
        input_["deletion_protection_enabled"] = deletion_protection_enabled
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output