webhooks

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Events = []Event{
	{Name: "reception", Type: "message.reception"},
	{Name: "delivered", Type: "message.delivered"},
	{Name: "transient_error", Type: "message.transient_error"},
	{Name: "failed", Type: "message.failed"},
	{Name: "bounced", Type: "message.bounced"},
	{Name: "suppressed", Type: "message.suppressed"},
	{Name: "opened", Type: "message.opened"},
	{Name: "clicked", Type: "message.clicked"},
	{Name: "unsubscribed", Type: "message.unsubscribed"},
	{Name: "complained", Type: "message.complained"},
	{Name: "suppression_created", Type: "suppression.created"},
	{Name: "suppression_deleted", Type: "suppression.deleted"},
	{Name: "dns_error", Type: "domain.dns_error"},
	{Name: "contact_created", Type: "contact.created", Contact: true},
	{Name: "contact_updated", Type: "contact.updated", Contact: true},
	{Name: "contact_deleted", Type: "contact.deleted", Contact: true},
	{Name: "contact_added_to_list", Type: "contact.added_to_list", Contact: true},
	{Name: "contact_removed_from_list", Type: "contact.removed_from_list", Contact: true},
	{Name: "contact_subscribed", Type: "contact.subscribed", Contact: true},
	{Name: "contact_unsubscribed", Type: "contact.unsubscribed", Contact: true},
	{Name: "contact_complained", Type: "contact.complained", Contact: true},
}

Events lists every webhook event type, in the order the CLI shows them.

Functions

func EventNames added in v0.3.0

func EventNames(events []Event) []string

EventNames returns the Name of each event, or nil when there are none.

func EventTypes added in v0.3.0

func EventTypes(events []Event) []string

EventTypes returns the Type of each event, or nil when there are none.

func EventValues added in v0.3.0

func EventValues() []string

EventValues returns the values --events takes: the Name of each event, then its Type.

func GenerateMsgID

func GenerateMsgID() string

func GenerateWebhookSecret

func GenerateWebhookSecret() (string, error)

GenerateWebhookSecret returns a new secret for signing webhooks: "aha-whsec-" and 64 random letters and digits.

Types

type Event added in v0.3.0

type Event struct {
	Name string
	Type string
	// Contact marks a contact event, which the API allows only for an
	// account with the marketing features and an API key with the contact
	// read scopes.
	Contact bool
}

Event is a webhook event type. A webhook's settings name it by Name, as the API's on_<name> fields do; event payloads, the trigger endpoint and the listen filter name it by Type.

func FindEvent added in v0.3.0

func FindEvent(value string) (Event, bool)

FindEvent returns the event value names by its Name or its Type, in any case.

func ParseEvents added in v0.3.0

func ParseEvents(values []string) ([]Event, error)

ParseEvents returns the event each value names, by its Name or its Type in any case, in the order given. Values that name no event, which the error names before it lists the events, and a value that names an event an earlier value named, are validation errors of the --events flag.

func SelectEvents added in v0.4.0

func SelectEvents(events []Event, all, allContact bool) []Event

SelectEvents returns the events the event flags select: events, the ones --events named, then, in the order of Events, every event but the contact events when all is set, and every contact event when allContact is set.

type Signer

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

func NewSigner

func NewSigner(secret string) *Signer

func (*Signer) Sign

func (s *Signer) Sign(msgID string, timestamp time.Time, payload []byte) (string, error)

Jump to

Keyboard shortcuts

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