Hooky
Hooky is a Ruby gem that provides a simple way to test webhooks.
By storing example request data and configuration in a .hooky
directory in your Rails root directory, you can easily
test webhooks by running hooky <webhook_name>
.
You can create as many webhooks as you required but they must be named like so:
.hooky/<webhook_name>/data.json
.hooky/<webhook_name>/config.json
The config.json
file contains details such as the URL, HTTP Method and any headers. For example:
{
"url": "https://example.com/webhooks/order.created",
"method": "GET",
"headers": {
"Content-Type": "application/json"
}
}
The data.json
file will be the request body that is sent. For example:
{
"id": 123,
"name": "John Doe"
}
Installation
Install the gem by running gem install hooky
.
Usage
# To add the hooky gem to your Gemfile, create a .hooky directory and create an example webhook, run:
hooky init
# To test a webhook, run:
hooky hook <webhook_name>
To add the gem to your Rails app and create an example webhook, run bundle exec hooky init
. This will create a .hooky
directory and
Then to test this webhook, run rails hooky order.created
and it will send a request to the URL specified in the data.json
file.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/deanpcmad/hooky.
License
The gem is available as open source under the terms of the MIT License.