ntfy

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package ntfy is the notify adapter for ntfy, the push notification service (R-374, issue #50): ntfy.sh or a server of your own.

A topic is a channel, so this is a channel adapter and only subscriptions send to it (R-373). On ntfy.sh anyone who knows a topic's name can read it, which makes the name a credential: it is stored sealed, like a password.

Index

Constants

View Source
const DefaultServer = "https://ntfy.sh"

DefaultServer is the public ntfy server.

View Source
const Kind = "ntfy"

Kind is the adapter's kind string.

Variables

This section is empty.

Functions

func Info

func Info() api.KindInfo

Info describes this kind of adapter for the forms that configure one.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter publishes to one topic.

func New

func New() *Adapter

New returns an unconfigured adapter.

func (*Adapter) Capabilities

func (a *Adapter) Capabilities() api.NotifyCapabilities

Capabilities: a channel, not people.

func (*Adapter) Category

func (a *Adapter) Category() api.Category

func (*Adapter) Configure

func (a *Adapter) Configure(_ context.Context, raw json.RawMessage) error

Configure reads the configuration core assembled.

func (*Adapter) HealthCheck

func (a *Adapter) HealthCheck(context.Context) error

HealthCheck succeeds once configured. Publishing to check would be the thing it checks for.

func (*Adapter) Kind

func (a *Adapter) Kind() string

func (*Adapter) Notify

func (a *Adapter) Notify(ctx context.Context, n api.Notification) error

Notify publishes one message.

type Config

type Config struct {
	Credentials    Credentials `json:"credentials,omitzero"`
	ServerURL      string      `json:"server_url,omitempty"`
	Priority       string      `json:"priority,omitempty"`
	TimeoutSeconds int         `json:"timeout_seconds,omitempty"`
}

Config is the adapter's configuration.

type Credentials

type Credentials struct {
	Topic       secret.Value `json:"topic,omitzero"`
	AccessToken secret.Value `json:"access_token,omitzero"`
}

Credentials is what this adapter keeps secret.

Jump to

Keyboard shortcuts

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