From d6c1c1ea33de6386fabe7c9546bfae1c38d3b9e7 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 28 May 2016 17:36:55 -0400 Subject: Improve notification classes and move interface to core --- app/Notification/WebhookNotification.php | 56 ++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 app/Notification/WebhookNotification.php (limited to 'app/Notification/WebhookNotification.php') diff --git a/app/Notification/WebhookNotification.php b/app/Notification/WebhookNotification.php new file mode 100644 index 00000000..25d59251 --- /dev/null +++ b/app/Notification/WebhookNotification.php @@ -0,0 +1,56 @@ +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, + ); + + $this->httpClient->postJson($url, $payload); + } + } +} -- cgit v1.2.3