Skip to content

delete_sms_template

delete_sms_template(
    template_name: __string,
    *,
    config_overrides: Optional[PinpointClientConfig] = None,
    version: Optional[__string] = None,
) -> DeleteSmsTemplateResponse

Deletes a message template for messages that were sent through the SMS channel.

Parameters:

  • template_name (__string) –

    The name of the message template. A template name must start with an alphanumeric character and can contain a maximum of 128 characters. The characters can be alphanumeric characters, underscores (_), or hyphens (-). Template names are case sensitive.

  • version (Optional[__string], default: None ) –

    The unique identifier for the version of the message template to update, retrieve information about, or delete. To retrieve identifiers and other information for all the versions of a template, use the Template Versions resource.

    If specified, this value must match the identifier for an existing template version. If specified for an update operation, this value must match the identifier for the latest existing version of the template. This restriction helps ensure that race conditions don't occur.

    If you don't specify a value for this parameter, Amazon Pinpoint does the following:

    • For a get operation, retrieves information about the active version of the template.

    • For an update operation, saves the updates to (overwrites) the latest existing version of the template, if the create-new-version parameter isn't used or is set to false.

    • For a delete operation, deletes the template, including all versions of the template.

Raises:

Source code in docs_src/capo_pinpoint/_services/pinpoint.py
def delete_sms_template(
    self,
    template_name: "capo_pinpoint.types.__string.__string",
    *,
    config_overrides: Optional[PinpointClientConfig] = None,
    version: Optional["capo_pinpoint.types.__string.__string"] = None,
) -> "capo_pinpoint.types.delete_sms_template_response.DeleteSmsTemplateResponse":
    """<p>Deletes a message template for messages that were sent through the SMS channel.</p>

    Args:
        template_name: <p>The name of the message template. A template name must start with an alphanumeric character and can contain a maximum of 128 characters. The characters can be alphanumeric characters, underscores (_), or hyphens (-). Template names are case sensitive.</p>
        version: <p>The unique identifier for the version of the message template to update, retrieve information about, or delete. To retrieve identifiers and other information for all the versions of a template, use the <link linkend="templates-template-name-template-type-versions">Template Versions</link> resource.</p> <p>If specified, this value must match the identifier for an existing template version. If specified for an update operation, this value must match the identifier for the latest existing version of the template. This restriction helps ensure that race conditions don't occur.</p> <p>If you don't specify a value for this parameter, Amazon Pinpoint does the following:</p> <ul><li><p>For a get operation, retrieves information about the active version of the template.</p></li> <li><p>For an update operation, saves the updates to (overwrites) the latest existing version of the template, if the create-new-version parameter isn't used or is set to false.</p></li> <li><p>For a delete operation, deletes the template, including all versions of the template.</p></li></ul>

    Raises:
        capo_pinpoint.errors.bad_request_exception.BadRequestException: <p>Provides information about an API request or response.</p>
        capo_pinpoint.errors.forbidden_exception.ForbiddenException: <p>Provides information about an API request or response.</p>
        capo_pinpoint.errors.internal_server_error_exception.InternalServerErrorException: <p>Provides information about an API request or response.</p>
        capo_pinpoint.errors.method_not_allowed_exception.MethodNotAllowedException: <p>Provides information about an API request or response.</p>
        capo_pinpoint.errors.not_found_exception.NotFoundException: <p>Provides information about an API request or response.</p>
        capo_pinpoint.errors.payload_too_large_exception.PayloadTooLargeException: <p>Provides information about an API request or response.</p>
        capo_pinpoint.errors.too_many_requests_exception.TooManyRequestsException: <p>Provides information about an API request or response.</p>
        capo_pinpoint.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_pinpoint.types.delete_sms_template_request.DeleteSmsTemplateRequest]",
    ) -> OperationResponse[
        "capo_pinpoint.types.delete_sms_template_response.DeleteSmsTemplateResponse"
    ]:
        import capo_pinpoint._operations.pinpoint.delete_sms_template

        output, http_response = (
            capo_pinpoint._operations.pinpoint.delete_sms_template.delete_sms_template(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteSmsTemplate")
    )
    input_: capo_pinpoint.types.delete_sms_template_request.DeleteSmsTemplateRequest = {
        "template_name": template_name
    }
    if version is not None:
        input_["version"] = version

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output