Skip to main content

Method

func (s *WebhooksSvcImpl) Create(params *CreateWebhookRequest) (*CreateWebhookResponse, error)
func (s *WebhooksSvcImpl) CreateWithContext(ctx context.Context, params *CreateWebhookRequest) (*CreateWebhookResponse, error)

Parameters

params
*CreateWebhookRequest
required
The webhook creation parameters
Endpoint
string
required
The URL endpoint that will receive webhook events
Events
[]string
required
Array of event types to subscribe to. Available events:
  • email.sent
  • email.delivered
  • email.delivery_delayed
  • email.complained
  • email.bounced
  • email.opened
  • email.clicked
  • email.received
  • email.failed
  • contact.created
  • contact.updated
  • contact.deleted
  • domain.created
  • domain.updated
  • domain.deleted

Response

Object
string
Always "webhook"
Id
string
The unique identifier of the created webhook
SigningSecret
string
The signing secret for verifying webhook payloads. Store this securely - it’s only shown once.

Example

client := resend.NewClient("re_123456789")

params := &resend.CreateWebhookRequest{
    Endpoint: "https://example.com/webhooks/resend",
    Events: []string{
        resend.EventEmailSent,
        resend.EventEmailDelivered,
        resend.EventEmailBounced,
    },
}

webhook, err := client.Webhooks.Create(params)
if err != nil {
    panic(err)
}

fmt.Println("Webhook ID:", webhook.Id)
fmt.Println("Signing Secret:", webhook.SigningSecret)

Build docs developers (and LLMs) love