Notification Template Management using Spyctl
To learn more about what Notification Templates are, see Notification Templates
Prerequisites
If you have never used Spyctl start here to learn how to install it, then follow the Initial Configuration 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:
email - Create an email notification template.
pagerduty - Create a PagerDuty notification template.
slack - Create a Slack notification template.
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.
spyctl create notification-template [TYPE] -n NAMEFor example:
spyctl create notification-template slack -n slack-template > template.yamlThis will create a default Slack Notification Template and save it to a file called template.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.yamlNote: Learn How to populate the Template field values here
Apply
To make a Notification Template available for use, apply it using the apply command:
spyctl apply -f FILENAMEFor example:
spyctl apply -f template.yamlGet or Download
You can use the get command to view or download your Notification Templates.
spyctl get notification-templatesFor example:
spyctl get notification-templatesGetting 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:
spyctl get notification-templates -o yaml slack-templateUsing the > character, you can save the document to a file:
spyctl get notification-templates -o yaml slack-template > template.yamlEdit
To modify an existing Notification Template, use the edit command:
spyctl edit notification-template NAME_OR_UIDFor example:
spyctl edit notification-template slack-templateThis 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:
spyctl delete notification-template <NAME_OR_UID>For example:
spyctl delete notification-template slack-templateLast updated
Was this helpful?