Socket server allows connecting to Webhook Relay service directly from your application using WebSockets. Communication is done using JSON encoded messages. In order to start streaming, create a new bucket with your desired name:
Once you have a bucket, you can start receiving webhooks to your public endpoint (one public endpoint will be created by default upon bucket creation).
WebSockets will receive events with webhook data when both no outputs are defined or for every internal output specified. If you only have public outputs, neither WebSockets nor relay agent will receive them.
Your API keys allow multiple simultaneous connections. Connect to:
You must authenticate before you can make any other requests. Generate a new key & secret pair in your tokens page (https://my.webhookrelay.com/tokens). To authenticate, send:
Once authenticated, you will receive the following message:
Once authenticated, you can request a stream. Buckets (https://my.webhookrelay.com/buckets) are used for grouping and routing. You can request multiple bucket streams. To subscribe, send:
bucketsworks as a filter, checking for bucket ID or bucket name. To subscribe to all buckets in your account, send only
Once subscribed, you will receive the following message, confirming your stream:
All incoming webhooks will have event type set to
webhook and attached
meta field with additional information such as bucket ID, bucket name, input ID, input name:
2. Set token key and secret (from tokens page):
Now, if you send a webhook to your public input endpoint, you should see something similar:
npm. Library source code is available on GitHub. It’s written in Typescript is a thin wrapper around our WebSocket server client. It can only subscribe to buckets but cannot create/update/delete them.
To install it:
Set tokens as environment variables:
To run it:
Now, whenever you send webhooks to your public endpoint
https://my.webhookrelay.com/v1/webhooks/<your input ID>, they will be received inside your application. You can subscribe to multiple buckets. Each message will have a JSON string that you can parse: