Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Latest commit

 

History

History
60 lines (49 loc) · 2.73 KB

webhook.md

File metadata and controls

60 lines (49 loc) · 2.73 KB

WebHook notifier

This notifier ships notifications over the HTTP protocol.

Usage

Just add the HTTParty gem to your Gemfile:

gem 'httparty'

To configure it, you need to set the url option, like this:

Rails.application.config.middleware.use ExceptionNotification::Rack,
                                        email: {
                                          email_prefix: '[PREFIX] ',
                                          sender_address: %{"notifier" <notifier@example.com>},
                                          exception_recipients: %w{exceptions@example.com}
                                        },
                                        webhook: {
                                          url: 'http://domain.com:5555/hubot/path'
                                        }

By default, the WebhookNotifier will call the URLs using the POST method. But, you can change this using the http_method option.

Rails.application.config.middleware.use ExceptionNotification::Rack,
                                        email: {
                                          email_prefix: '[PREFIX] ',
                                          sender_address: %{"notifier" <notifier@example.com>},
                                          exception_recipients: %w{exceptions@example.com}
                                        },
                                        webhook: {
                                          url: 'http://domain.com:5555/hubot/path',
                                          http_method: :get
                                        }

Besides the url and http_method options, all the other options are passed directly to HTTParty. Thus, if the HTTP server requires authentication, you can include the following options:

Rails.application.config.middleware.use ExceptionNotification::Rack,
                                        email: {
                                          email_prefix: '[PREFIX] ',
                                          sender_address: %{"notifier" <notifier@example.com>},
                                          exception_recipients: %w{exceptions@example.com}
                                        },
                                        webhook: {
                                          url: 'http://domain.com:5555/hubot/path',
                                          basic_auth: {
                                            username: 'alice',
                                            password: 'password'
                                          }
                                        }

For more HTTParty options, check out the documentation.