Version: v0.7.1 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2023 License: MIT Imports: 9 Imported by: 0



Package ntfy implements Ntfy as a shoutrrr service



View Source
const (
	Scheme = "ntfy"

Scheme is the identifying part of this service's configuration URL


View Source
var Priority = &priorityVals{
	Min:     1,
	Low:     2,
	Default: 3,
	High:    4,
	Max:     5,
	Enum: format.CreateEnumFormatter(
		}, map[string]int{
			"1":      1,
			"2":      2,
			"3":      3,
			"4":      4,
			"5":      5,
			"urgent": 5,

Priority ...


This section is empty.


type Config

type Config struct {
	Title    string   `key:"title"       default:""          desc:"Message title"`
	Host     string   `url:"host"        default:"ntfy.sh"   desc:"Server hostname and port"`
	Topic    string   `url:"path"        required:""         desc:"Target topic name"`
	Password string   `url:"password"    optional:""         desc:"Auth password"`
	Username string   `url:"user"        optional:""         desc:"Auth username"`
	Scheme   string   `key:"scheme"      default:"https"     desc:"Server protocol, http or https"`
	Tags     []string `key:"tags"        optional:""         desc:"List of tags that may or not map to emojis"`
	Priority priority `key:"priority"    default:"default"   desc:"Message priority with 1=min, 3=default and 5=max"`
	Actions  []string `` /* 139-byte string literal not displayed */
	Click    string   `key:"click"       optional:""         desc:"Website opened when notification is clicked"`
	Attach   string   `key:"attach"      optional:""         desc:"URL of an attachment, see attach via URL"`
	Filename string   `key:"filename"    optional:""         desc:"File name of the attachment"`
	Delay    string   `` /* 141-byte string literal not displayed */
	Email    string   `key:"email"       optional:""         desc:"E-mail address for e-mail notifications"`
	Icon     string   `key:"icon"        optional:""         desc:"URL to use as notification icon"`
	Cache    bool     `key:"cache"       default:"yes"       desc:"Cache messages"`
	Firebase bool     `key:"firebase"    default:"yes"       desc:"Send to firebase"`

Config for use within the ntfy service

func (*Config) Enums

func (*Config) Enums() map[string]types.EnumFormatter

Enums implements types.ServiceConfig

func (*Config) GetAPIURL

func (config *Config) GetAPIURL() string

GetAPIURL returns the API URL corresponding to the passed endpoint based on the configuration

func (*Config) GetURL

func (config *Config) GetURL() *url.URL

GetURL returns a URL representation of it's current field values

func (*Config) SetURL

func (config *Config) SetURL(url *url.URL) error

SetURL updates a ServiceConfig from a URL representation of it's field values

type Service

type Service struct {
	// contains filtered or unexported fields

Service sends notifications Ntfy

func (*Service) Initialize

func (service *Service) Initialize(configURL *url.URL, logger types.StdLogger) error

Initialize loads ServiceConfig from configURL and sets logger for this Service

func (*Service) Send

func (service *Service) Send(message string, params *types.Params) error

Send a notification message to Ntfy

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL