Project

webhukhs

0.0
No release in over 3 years
Webhukhs is a Rails engine for processing webhooks from various services. Engine saves webhook in database first and later processes webhook in async process. Supports custom handlers with Webhukhs::BaseHandler and integrates with Rails common error reporter.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

Runtime

 Project Readme

Webhukhs

Webhukhs is a Rails engine for processing webhooks from various services. Engine saves webhook in database first and later processes webhook in async process.

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add webhukhs

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install webhukhs

Usage

Generate migrations and initializer file.

bin/rails g webhukhs:install

Mount webhukhs engine in your routes.

mount Webhukhs::Engine, at: "/webhooks"

Define a class for your first handler (let's call it ExampleHandler) and inherit it from Webhukhs::BaseHandler. Place it somewhere where Rails autoloading can find it, and add it to your webhukhs.rb config file:

config.active_handlers = {
  "example" => "ExampleHandler"
}

Example handlers

We provide a number of webhook handlers which demonstrate certain features of Webhukhs. You will find them in handler-examples.

Requirements

This project depends on two dependencies:

  • Ruby >= 3.0
  • Rails >= 7.0

Error reporter

This gem uses Rails common error reporter to report any possible error to services like Honeybadger, Appsignal, Sentry and etc. Most of those services already support this common interface, if not - it's not that hard to add this support on your own.

It's possible to provide additional context for every error. e.g.

Webhukhs.configure do |config|
  config.error_context = { appsignal: { namespace: "webhooks" } }
end

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/skatkov/webhukhs.

License

The gem is available as open source under the terms of the MIT License.