From 472f94efee77d8f47ece4ead7d36ee02e5df3e56 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 17 Oct 2015 12:30:05 -0400 Subject: Move webhook to project notification type --- app/Notification/Webhook.php | 55 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 app/Notification/Webhook.php (limited to 'app/Notification') diff --git a/app/Notification/Webhook.php b/app/Notification/Webhook.php new file mode 100644 index 00000000..feeee5d6 --- /dev/null +++ b/app/Notification/Webhook.php @@ -0,0 +1,55 @@ +config->get('webhook_url'); + $token = $this->config->get('webhook_token'); + + if (! empty($url)) { + if (strpos($url, '?') !== false) { + $url .= '&token='.$token; + } else { + $url .= '?token='.$token; + } + + $payload = array( + 'event_name' => $event_name, + 'event_data' => $event_data, + ); + + return $this->httpClient->postJson($url, $payload); + } + } +} -- cgit v1.2.3