From 7e7f29e5b6a612be5e4888f241e88ca871347d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandru=20Sp=C4=83taru?= Date: Thu, 11 Jun 2026 11:22:32 +0300 Subject: [PATCH 1/3] add notifyRocketChat function --- lib/CreateCardClass.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/lib/CreateCardClass.php b/lib/CreateCardClass.php index 8826e0a..1ba4e4e 100644 --- a/lib/CreateCardClass.php +++ b/lib/CreateCardClass.php @@ -86,6 +86,10 @@ function createCard($newcard, $data, $mailSender, $cleanedSubject, $inbox, $boar $response = $newcard->addCard($data, $mailSender->origin, $mailSender->host, $board); error_log("New card created with response: " . json_encode($response)); + if ($response && defined('ROCKETCHAT_WEBHOOK')){ + $this->notifyRocketChat($response); + } + if($data->attachments){ $imageUrls = $newcard->addAttachments($response, $data->attachments); if (!empty($imageUrls)) { @@ -106,4 +110,28 @@ function createCard($newcard, $data, $mailSender, $cleanedSubject, $inbox, $boar error_log("Comment added with response: " . json_encode($response)); } } -} \ No newline at end of file + + function notifyRocketChat($card){ + $cardUrl = NC_SERVER . "/index.php/apps/deck/board/{$card->board}/card/{$card->id}"; + $boardTitle = $card->boardTitle ?? "Deck"; + $payload = json_encode([ + 'text' => "New ticket on **{$boardTitle}**\n[{$card->title}]({$cardUrl})" + ]); + + $curl = curl_init(); + curl_setopt_array($curl, [ + CURLOPT_URL => ROCKETCHAT_WEBHOOK, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_POST => true, + CURLOPT_POSTFIELDS => $payload, + CURLOPT_HTTPHEADER => ['Content-Type: application/json'], + CURLOPT_TIMEOUT => 5, + ]); + + $resp = curl_exec($curl); + if (curl_errno($curl)) { + error_log("RocketChat notify error: " . curl_error($curl)); + } + + curl_close($curl); +} From 72610469c9124987f4b642a0e3482aacf66fe0cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandru=20Sp=C4=83taru?= Date: Thu, 11 Jun 2026 11:37:38 +0300 Subject: [PATCH 2/3] Update CreateCardClass.php --- lib/CreateCardClass.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/CreateCardClass.php b/lib/CreateCardClass.php index 1ba4e4e..540976e 100644 --- a/lib/CreateCardClass.php +++ b/lib/CreateCardClass.php @@ -134,4 +134,5 @@ function notifyRocketChat($card){ } curl_close($curl); + } } From a82bf2ae38504cea38790333dfa5b10834b8ae60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandru=20Sp=C4=83taru?= Date: Thu, 11 Jun 2026 11:43:06 +0300 Subject: [PATCH 3/3] Update config.example.php --- config.example.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config.example.php b/config.example.php index 50fb977..e4b58b6 100644 --- a/config.example.php +++ b/config.example.php @@ -25,4 +25,6 @@ "DOMAIN_OA" => "@oa", "DOMAIN_CA" => "@ca" ]); -define("MAIL_SUPPORT","");//If not empty, use this value to send to the Support team: card url, the description and who submitted the request. \ No newline at end of file +define("MAIL_SUPPORT","");//If not empty, use this value to send to the Support team: card url, the description and who submitted the request. + +define("ROCKETCHAT_WEBHOOK", ""); //add rocketchat notification webhook