Listening for Webhook Events
To start listening for webhook events, use thewebhook listen command:
Filtering Events
You can filter the events you want to listen for by specifying event types:EVENT_TYPE1,EVENT_TYPE2 with the specific event types you’re interested in, separated by commas.
To see a list of all available event types, run
cobo webhook events.Forwarding Events
The CLI can also forward received events to a specified URL, which is useful for testing your webhook endpoint:Combining Filtering and Forwarding
You can combine event filtering and forwarding in a single command:Output
The CLI will print each received event to the console in JSON format. If forwarding is enabled, it will also attempt to send the event to the specified URL and report any errors encountered during forwarding.Stopping the Listener
To stop listening for events, simply pressCtrl+C in your terminal. The CLI will gracefully close the WebSocket connection and terminate the process.
Best Practices
-
Use in Development: The
webhook listencommand is primarily intended for use in development and testing environments. For production, set up a proper webhook endpoint in your application. -
Secure Forwarding: When using the
--forwardoption, ensure that your endpoint is properly secured, especially if you’re forwarding to a public URL. -
Event Type Familiarity: Familiarize yourself with the available event types by running
cobo webhook events. This will help you filter for relevant events and reduce noise in your testing process. - Error Handling: Pay attention to any error messages in the CLI output, especially when forwarding events. This can help you identify and resolve issues with your webhook endpoint.
