pushover

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package pushover implements a Pushover notifier, allowing messages to be sent to multiple recipients and supports both users and groups.

Usage:

package main

import (
	"context"

	"github.com/nikoksr/notify"
	"github.com/nikoksr/notify/service/pushover"
)

func main() {

	notifier := notify.New()

	// Provide your Pushover App token
	pushoverService := pushover.New("APP_TOKEN")

	// Pass user and/or group IDs for where to send the messages
	pushoverService.AddReceivers("USER_ID", "GROUP_ID")

	// Tell our notifier to use the Pushover service. You can repeat the above process
	// for as many services as you like and just tell the notifier to use them.
	notifier.UseServices(pushoverService)

	// Send a message
	_ = notifier.Send(
		context.Background(),
		"Hello!",
		"I am a bot written in Go!",
	)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pushover

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

Pushover struct holds necessary data to communicate with the Pushover API.

func New

func New(appToken string) *Pushover

New returns a new instance of a Pushover notification service. For more information about Pushover app token:

-> https://support.pushover.net/i175-how-do-i-get-an-api-or-application-token

func (*Pushover) AddReceivers

func (p *Pushover) AddReceivers(recipientIDs ...string)

AddReceivers takes Pushover user/group IDs and adds them to the internal recipient list. The Send method will send a given message to all of those recipients.

func (Pushover) Send

func (p Pushover) Send(ctx context.Context, subject, message string) error

Send takes a message subject and a message body and sends them to all previously set recipients.

Jump to

Keyboard shortcuts

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