> For the complete documentation index, see [llms.txt](https://docs.spyderbat.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.spyderbat.com/reference/spyctl/notification-template-management-spyctl.md).

# Notification Template Management using Spyctl

To learn more about what Notification Templates are, see [Notification Templates](/concepts/notifications/notification-templates.md)

## Prerequisites

If you have never used Spyctl start [here](/installation/spyctl.md) to learn how to install it, then follow the [Initial Configuration](/installation/spyctl.md) guide.

## What are Notification Templates?

Notification Templates define the format of notifications sent via different channels such as Email, Slack, Webhook, and PagerDuty. These templates help in customizing the notification messages. You can either specify a Notification Target or a Notification Template that map specific targets to templates.

**Available Notification Template Types:**

1. email - Create an email notification template.
2. pagerduty - Create a PagerDuty notification template.
3. slack - Create a Slack notification template.
4. webhook - Create a webhook notification template.

## Managing Notification Templates

### Create

To create a new Notification Template, use the create command:

Note: This will only create a local YAML file for you to edit. It makes no immediate changes to your Spyderbat environment.

```sh
 spyctl create notification-template [TYPE] -n NAME
```

For example:

```sh
 spyctl create notification-template slack -n slack-template > template.yaml
```

This will create a default Slack Notification Template and save it to a file called template.yaml.

```yaml
apiVersion: spyderbat/v1
kind: NotificationTemplate
metadata:
  name: Example
  type: slack
spec:
  text: ''
  blocks: []
```

To get the template in JSON format use `-o json` option:

```
 spyctl create notification-template slack -n slack-template -o json > template.yaml
```

Note: Learn How to populate the Template field values [here](/concepts/notifications/notification-templates.md)

### Apply

To make a Notification Template available for use, apply it using the apply command:

```
 spyctl apply -f FILENAME
```

For example:

```
 spyctl apply -f template.yaml
```

### Get or Download

You can use the get command to view or download your Notification Templates.

```sh
 spyctl get notification-templates
```

For example:

```sh
 spyctl get notification-templates
```

```
Getting notification-templates
Page 1/1
NAME                 UID                        TYPE       CREATED                     DESCRIPTION
test-email-tmpl      tmpl:avgUE                 email      2024-09-30T21:06:03 UTC     Operations teams.
```

To download a Notification Template as YAML or JSON, use the -o option:

```sh
 spyctl get notification-templates -o yaml slack-template
```

Using the > character, you can save the document to a file:

```sh
 spyctl get notification-templates -o yaml slack-template > template.yaml
```

### Edit

To modify an existing Notification Template, use the edit command:

```sh
spyctl edit notification-template NAME_OR_UID
```

For example:

```sh
 spyctl edit notification-template slack-template
```

This will open the template in your configured text editor for modification.

### Delete

To remove a Notification Template from the Spyderbat system, use the delete command:

```sh
spyctl delete notification-template <NAME_OR_UID>
```

For example:

```sh
spyctl delete notification-template slack-template
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.spyderbat.com/reference/spyctl/notification-template-management-spyctl.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
