Skip to content

Go SDK

The official HookBridge SDK for Go provides a simple, idiomatic way to integrate with HookBridge.

Terminal window
go get github.com/hookbridge/hookbridge-go
package main
import (
"context"
"fmt"
"log"
hookbridge "github.com/hookbridge/hookbridge-go"
)
func main() {
client, err := hookbridge.NewClient("YOUR_API_KEY")
if err != nil {
log.Fatal(err)
}
ctx := context.Background()
// Create an endpoint
desc := "My webhook endpoint"
endpoint, err := client.CreateEndpoint(ctx, hookbridge.CreateEndpointRequest{
URL: "https://your-app.com/webhooks",
Description: &desc,
})
if err != nil {
log.Fatal(err)
}
// Send a webhook
result, err := client.Send(ctx, hookbridge.SendRequest{
EndpointID: endpoint.ID,
Payload: map[string]any{
"event": "user.created",
"data": map[string]any{
"user_id": "123",
"email": "user@example.com",
},
},
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Message sent: %s\n", result.MessageID)
}
Personalize Examples

Enter your credentials to populate code examples throughout the docs.