Skip to content

update_push_template

update_push_template(
    template_name: __string,
    *,
    config_overrides: Optional[PinpointClientConfig] = None,
    create_new_version: Optional[__boolean] = None,
    push_notification_template_request: Optional[
        PushNotificationTemplateRequest
    ] = None,
    version: Optional[__string] = None,
) -> UpdatePushTemplateResponse

Updates an existing message template for messages that are sent through a push notification channel.

Parameters:

  • create_new_version (Optional[__boolean], default: None ) –

    Specifies whether to save the updates as a new version of the message template. Valid values are: true, save the updates as a new version; and, false, save the updates to (overwrite) the latest existing version of the template.

    If you don't specify a value for this parameter, Amazon Pinpoint saves the updates to (overwrites) the latest existing version of the template. If you specify a value of true for this parameter, don't specify a value for the version parameter. Otherwise, an error will occur.

  • 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 update_push_template(
    self,
    template_name: "capo_pinpoint.types.__string.__string",
    *,
    config_overrides: Optional[PinpointClientConfig] = None,
    create_new_version: Optional["capo_pinpoint.types.__boolean.__boolean"] = None,
    push_notification_template_request: Optional[
        "capo_pinpoint.types.push_notification_template_request.PushNotificationTemplateRequest"
    ] = None,
    version: Optional["capo_pinpoint.types.__string.__string"] = None,
) -> "capo_pinpoint.types.update_push_template_response.UpdatePushTemplateResponse":
    """<p>Updates an existing message template for messages that are sent through a push notification channel.</p>

    Args:
        create_new_version: <p>Specifies whether to save the updates as a new version of the message template. Valid values are: true, save the updates as a new version; and, false, save the updates to (overwrite) the latest existing version of the template.</p> <p>If you don't specify a value for this parameter, Amazon Pinpoint saves the updates to (overwrites) the latest existing version of the template. If you specify a value of true for this parameter, don't specify a value for the version parameter. Otherwise, an error will occur.</p>
        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.update_push_template_request.UpdatePushTemplateRequest]",
    ) -> OperationResponse[
        "capo_pinpoint.types.update_push_template_response.UpdatePushTemplateResponse"
    ]:
        import capo_pinpoint._operations.pinpoint.update_push_template

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdatePushTemplate")
    )
    input_: capo_pinpoint.types.update_push_template_request.UpdatePushTemplateRequest = {
        "template_name": template_name
    }
    if create_new_version is not None:
        input_["create_new_version"] = create_new_version
    if push_notification_template_request is not None:
        input_["push_notification_template_request"] = (
            push_notification_template_request
        )
    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