Official Go SDK for Hookfreight.
Capture, inspect, replay, and reliably deliver webhooks with full visibility.
go get github.com/hookfreight/hookfreight-gopackage main
import (
"context"
"fmt"
hookfreight "github.com/hookfreight/hookfreight-go"
)
func main() {
hf := hookfreight.NewClient(hookfreight.Config{APIKey: "hf_sk_..."})
result, err := hf.Deliveries.List(context.Background(), &hookfreight.ListDeliveriesParams{
PaginationParams: hookfreight.PaginationParams{Limit: 10},
})
if err != nil {
panic(err)
}
fmt.Println(result.Deliveries)
}hf := hookfreight.NewClient(hookfreight.Config{
BaseURL: "http://localhost:3030/api/v1",
})| Option | Type | Default | Description |
|---|---|---|---|
APIKey |
string |
— | API key for Hookfreight Cloud. Optional for self-hosted. |
BaseURL |
string |
https://api.hookfreight.com/v1 |
Base URL of the API. Override for self-hosted. |
Timeout |
time.Duration |
30s |
Request timeout. |
HTTPClient |
HTTPDoer |
http.Client |
Optional custom HTTP client. |
ctx := context.Background()
app, _ := hf.Apps.Create(ctx, hookfreight.CreateAppParams{Name: "My App"})
endpoint, _ := hf.Endpoints.Create(ctx, hookfreight.CreateEndpointParams{
Name: "Stripe",
AppID: app.ID,
ForwardURL: "https://example.com/webhooks/stripe",
})
_, _ = hf.Events.Get(ctx, "evt_...")
stats, _ := hf.Deliveries.QueueStats(ctx)
fmt.Println(stats)
_, _ = hf.Endpoints.Delete(ctx, endpoint.ID)
_, _ = hf.Apps.Delete(ctx, app.ID)_, err := hf.Apps.Get(ctx, "app_nonexistent")
if err != nil {
var notFound *hookfreight.NotFoundError
if errors.As(err, ¬Found) {
fmt.Println("App not found")
}
}examples/basic_usage/main.goexamples/manage_endpoints/main.goexamples/retry_failed_deliveries/main.goexamples/monitor_queue/main.go
Apache-2.0