summaryrefslogtreecommitdiff
path: root/app/Model/Webhook.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Model/Webhook.php')
-rw-r--r--app/Model/Webhook.php23
1 files changed, 13 insertions, 10 deletions
diff --git a/app/Model/Webhook.php b/app/Model/Webhook.php
index b3603818..8c270fb6 100644
--- a/app/Model/Webhook.php
+++ b/app/Model/Webhook.php
@@ -14,20 +14,23 @@ class Webhook extends Base
* Call the external URL
*
* @access public
- * @param string $url URL to call
- * @param array $task Task data
+ * @param array $values Event payload
*/
- public function notify($url, array $task)
+ public function notify(array $values)
{
+ $url = $this->config->get('webhook_url');
$token = $this->config->get('webhook_token');
- if (strpos($url, '?') !== false) {
- $url .= '&token='.$token;
- }
- else {
- $url .= '?token='.$token;
- }
+ if (! empty($url)) {
- return $this->httpClient->post($url, $task);
+ if (strpos($url, '?') !== false) {
+ $url .= '&token='.$token;
+ }
+ else {
+ $url .= '?token='.$token;
+ }
+
+ return $this->httpClient->post($url, $values);
+ }
}
}