https://github.com/webhookrelay/webhookrelay-go
Go library for the Webhook Relay v1 API
https://github.com/webhookrelay/webhookrelay-go
Last synced: 3 months ago
JSON representation
Go library for the Webhook Relay v1 API
- Host: GitHub
- URL: https://github.com/webhookrelay/webhookrelay-go
- Owner: webhookrelay
- License: bsd-3-clause
- Created: 2020-06-09T09:07:52.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2025-12-29T11:19:08.000Z (6 months ago)
- Last Synced: 2026-01-01T11:09:13.449Z (6 months ago)
- Language: Go
- Homepage: https://webhookrelay.com
- Size: 157 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Webhook Relay API Go client
[](https://godoc.org/github.com/webhookrelay/webhookrelay-go)
> This library is currently actively developed so the API might change a little bit.
## Installation
You need a working [Go](https://golang.org/) environment.
```shell
go get github.com/webhookrelay/webhookrelay-go
```
## Authentication
To authenticate, you will need to first get an API token key & secret pair [here](https://my.webhookrelay.com/tokens).
## Usage
```golang
package main
import (
"fmt"
"log"
"os"
"github.com/webhookrelay/webhookrelay-go"
)
func main() {
// Construct a new Webhook Relay API object to perform requests
api, err := webhookrelay.New(os.Getenv("RELAY_KEY"), os.Getenv("RELAY_SECRET"))
if err != nil {
log.Fatal(err)
}
bucket, err := api.CreateBucket(&webhookrelay.BucketCreateOptions{
Name: "sendgrid-to-segment",
})
if err != nil {
log.Fatal(err)
}
// all buckets get a default input that you can use to receive webhooks,
// it can either be used with custom domain + path prefix (https://xxx.hooks.webhookrelay.com)
// or input ID such as https://my.webhookrelay.com/v1/webhooks/xxx
fmt.Println(bucket.Inputs[0].EndpointURL())
// Create a webhook forwarding destination for this webhook
_, err = api.CreateOutput(&webhookrelay.Output{
BucketID: bucket.ID,
Name: "segment",
Destination: "https://webhooks.segment.com?b=yyyy",
})
if err != nil {
log.Fatal(err)
}
// list all buckets
buckets, err := api.ListBuckets(&webhookrelay.BucketListOptions{})
if err != nil {
log.Fatal(err)
}
fmt.Println(buckets) // print buckets
}
```