resend

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package resend provides utilities for processing incoming requests from resend.com over webhook.

https://resend.com/docs/dashboard/webhooks/event-types

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Click

type Click struct {
	IPAddress string `json:"ipAddress"`
	Link      string `json:"link"`
	Timestamp string `json:"timestamp"`
	UserAgent string `json:"userAgent"`
}

Click struct

type Data

type Data struct {
	CreatedAt string   `json:"created_at"`
	EmailID   string   `json:"email_id"`
	From      string   `json:"from"`
	To        []string `json:"to"`
	Click     Click    `json:"click"`
	Subject   string   `json:"subject"`
}

Data struct

type EventType

type EventType string

EventType represents the type of event

const (
	EmailSent            EventType = "email.sent"
	EmailDelivered       EventType = "email.delivered"
	EmailDeliveryDelayed EventType = "email.delivery_delayed"
	EmailComplained      EventType = "email.complained"
	EmailBounced         EventType = "email.bounced"
	EmailOpened          EventType = "email.opened"
	EmailClicked         EventType = "email.clicked"
)

all event types - email.sent - email.delivered - email.delivery_delayed - email.complained - email.bounced - email.opened - email.clicked

type Payload

type Payload struct {
	Type      EventType `json:"type"`
	CreatedAt string    `json:"created_at"`
	Data      Data      `json:"data"`
}

Payload struct to process the incoming request over webhook

func HandleRequest

func HandleRequest(r *http.Request, wh *svix.Webhook) (payload Payload, err error)

HandleRequest validates the incoming payload against the svix signature headers using the webhook signing secret and binds the raw data to a payload struct.

Jump to

Keyboard shortcuts

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