webhook

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateURL

func ValidateURL(rawURL string) error

ValidateURL performs basic validation on webhook URL without making a network request.

Types

type CampaignResult

type CampaignResult struct {
	JobID                string    `json:"job_id"`
	Status               string    `json:"status"`
	TotalRecipients      int       `json:"total_recipients"`
	SuccessfulDeliveries int       `json:"successful_deliveries"`
	FailedDeliveries     int       `json:"failed_deliveries"`
	StartTime            time.Time `json:"start_time"`
	EndTime              time.Time `json:"end_time"`
	DurationSeconds      int       `json:"duration_seconds"`
	CSVFile              string    `json:"csv_file,omitempty"`
	SheetURL             string    `json:"sheet_url,omitempty"`
	TemplateFile         string    `json:"template_file,omitempty"`
	ConcurrentWorkers    int       `json:"concurrent_workers"`
	ErrorMessage         string    `json:"error_message,omitempty"`
}

CampaignResult represents job completion data sent to webhook

type Client

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

Client handles webhook HTTP requests with goroutine tracking

func NewClient

func NewClient() *Client

NewClient creates a new webhook client with timeout configuration

func NewClientWithSecret

func NewClientWithSecret(secret string) *Client

NewClientWithSecret creates a webhook client that signs every request with an HMAC-SHA256 signature in the X-Mailgrid-Signature header (GitHub-compatible format).

func (*Client) Close

func (c *Client) Close()

Close waits for all pending webhook requests to complete

func (*Client) SendNotification

func (c *Client) SendNotification(webhookURL string, result CampaignResult) error

SendNotification sends a POST request to webhook URL with campaign results. This is non-blocking and spawns a goroutine for the HTTP request.

func (*Client) SendNotificationSync

func (c *Client) SendNotificationSync(webhookURL string, result CampaignResult) error

SendNotificationSync sends a synchronous POST request to webhook URL

Jump to

Keyboard shortcuts

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