The hooks application is an HTTP server that handles EventSub webhook callbacks from Twitch, allowing our backend to respond to events that occur on Twitch, such as the channel status changing, a viewer following or subscribing, etc.
- OpenAPI specification: https://golden-vcr.github.io/hooks/
When the hooks server receives a valid callback from Twitch, it generates an internal event and pushes it onto a queue. Further downstream in the backend, other applications consume those events in order to record and respond to state changes independently.
On a Linux or WSL system:
- Install Go 1.21
- Clone the terraform repo alongside
this one, and from the root of that repo:
- Ensure that the module is initialized (via
terraform init
) - Ensure that valid terraform state is present
- Run
terraform output -raw env_hooks_local > ../hooks/.env
to populate an.env
file. - Run
./local-rmq.sh up
to ensure that a RabbitMQ server is running locally (requires Docker).
- Ensure that the module is initialized (via
- Ensure that the auth server is running locally.
- From the root of this repository:
- Run
go run ./cmd/server
to start up the server.
- Run
Once done, the hooks server will be running at http://localhost:5003.
Note that the locally-running hooks server will not receive webhook callbacks from Twitch - we only register actual Twitch EventSub callbacks using the canonical public URL associated with our platform, i.e. https://goldenvcr.com.
Once you're running the hooks server locally as described above, you can simulate
Twitch-instigated events instead: simply run go run ./cmd/simulate
to see a list of subcommands corresponding to different event types, and invoke each
subcommand with -h
to see a list of configurable parameters.
For example, to simulate a raid from tsjonte
with 69 viewers, run:
go run ./cmd/simulate raid -username tsjonte -user-id 37071883 -num-viewers 69
Once the application is deployed to a live environment, an accompanying frontend allows an admin (i.e. a user logged into the webapp with broadcaster access) to view the status of required EventSub subscriptions, and to delete or create those subscriptions as needed. To register live webhook callbacks from Twitch to goldenvcr.com, visit: