Webhook-notifier package allows to receive GitLab/Github webhook payloads for Laravel application and send notifications to multiple Slack/Discord channels based on payload type.
One configuration to control all process, easy to setup.
You can install the package via composer:
composer require ihah/webhook-notifier
Publish config file
php artisan vendor:publish --provider="Ihah\WebhookNotifier\WebhookNotifierServiceProvider" --tag=config
By default gitlab notification webhook for slack is:
domain.com/gitlab/notify/slack
- Define
GITLAB_TOKEN
in .env file.
GITLAB_TOKEN
is used to check if request came from GitLab.GITLAB_TOKEN
should be set as webhook secret token in GitLab More information about GitLab webhooks.
- Config
../config/webhook-notifier.php
file
- Slack incomming webook urls should be always defined in .env file because they contain secret to your channel and can be blocked if they are leaked. More information about Slack Incoming Webhooks
all
array - send all supported notifications to defined channelspush
array - send all push notifications to defined channels
// .../config/webhook-notifier.php
'gitlab_token' => env('GITLAB_TOKEN'),
'slack' => [
'prefix' => 'gitlab/notify/',
'middleware'=> [],
'channels' => [
'all' => [
[
'name' => 'ricks-gitlab-channel',
'url' => env('RICKS_SLACK_CHANNEL_URL')
]
],
'push' => [
[
'name' => 'toms-gitlab-channel',
'url' => env('TOMS_SLACK_CHANNEL_URL')
],
[
'name' => 'jams-gitlab-channel',
'url' => env('JAMS_SLACK_CHANNEL_URL')
],
]
],
],
composer test
GitLab:
- GitLab push event
- GitLab issue event
- GitLab merge request event
GitHub:
- GitHub push event
- GitHub issue event
- GitHub merge request event
Slack:
- GitLab push notification to multiple channels
- GitLab issue notification to multiple channels
- GitLab merge notification to multiple channels
- GitHub push notification to multiple channels
- GitHub issue notification to multiple channels
- GitHub merge notification to multiple channels
Discord:
- GitLab push notification to multiple channels
- GitLab issue notification to multiple channels
- GitLab merge notification to multiple channels
- GitHub push notification to multiple channels
- GitHub issue notification to multiple channels
- GitHub merge notification to multiple channels
Other:
- Support events and listeners
- Send notifications using queues
Please see CHANGELOG for more information what has changed recently.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.