Documentation
¶
Overview ¶
Package ntfy sends reminders as push notifications through ntfy (https://ntfy.sh or a self-hosted server). It is a notify-only channel: the notification opens the subscription in the web when tapped.
Index ¶
Constants ¶
View Source
const DefaultServer = "https://ntfy.sh"
DefaultServer is the public ntfy service.
View Source
const Name = "ntfy"
Name is the channel name in channel_links.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Channel ¶
type Channel struct {
notify.OneWay
// Config returns the current server settings, read for every message.
Config func(ctx context.Context) Config
// Client must come from a netguard.Guard: the server address is typed
// by a person.
Client *http.Client
// PublicURL is the instance's public address ("" if unknown).
PublicURL string
}
Channel is the ntfy channel. Its chat id is the member's topic.
type Config ¶
type Config struct {
Server string `json:"server"`
// Token is an ntfy access token (tk_…) for servers that need one to
// publish. Optional.
Token string `json:"token,omitempty"`
}
Config is the ntfy server every member's topic lives on.
type Notification ¶
type Notification struct {
Topic string `json:"topic"`
Title string `json:"title,omitempty"`
Message string `json:"message,omitempty"`
Tags []string `json:"tags,omitempty"`
Priority int `json:"priority,omitempty"`
Click string `json:"click,omitempty"`
Actions []viewAction `json:"actions,omitempty"`
}
Notification is the body of ntfy's JSON publish API.
func FromMessage ¶
func FromMessage(topic string, m actions.Message, link string) Notification
FromMessage turns a message into a notification for a topic. link ("" for none) is opened when the notification is tapped and by its one button.
Click to show internal directories.
Click to hide internal directories.