Add webhook receivers for Jira and Microsoft Graph, and implement Outlook 365 email hub with inbox management features

This commit is contained in:
2026-09-10 14:08:34 +02:00
parent 25c2ffeef8
commit dc0b33a278
5 changed files with 1137 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
<?php
/**
* Jira Webhook Receiver
* Ontvangt webhook events van Atlassian Jira Cloud (issue_created, issue_updated, etc.)
*/
require_once __DIR__ . '/../../config/database.php';
header('Content-Type: application/json');
$rawPayload = file_get_contents('php://input');
$data = json_decode($rawPayload, true);
if (!$data) {
http_response_code(400);
echo json_encode(['error' => 'Invalid JSON payload']);
exit;
}
try {
$db = get_db_connection();
$event = $data['webhookEvent'] ?? 'jira:unknown';
$issueKey = $data['issue']['key'] ?? '';
$summary = $data['issue']['fields']['summary'] ?? '';
// Sla event tijdelijk op of invalidate session cache
error_log("Jira Webhook ontvangen: {$event} voor {$issueKey} - {$summary}");
echo json_encode([
'received' => true,
'event' => $event,
'issue_key' => $issueKey,
'timestamp' => date('Y-m-d H:i:s')
]);
exit;
} catch (Throwable $t) {
http_response_code(500);
echo json_encode(['error' => $t->getMessage()]);
}
+31
View File
@@ -0,0 +1,31 @@
<?php
/**
* Microsoft Graph Webhook Receiver
* Ontvangt subscription notifications voor /me/mailFolders('inbox')/messages en /me/events
*/
require_once __DIR__ . '/../../config/database.php';
// Validatie bij aanmaken van Graph subscription
if (isset($_GET['validationToken'])) {
header('Content-Type: text/plain; charset=utf-8');
http_response_code(200);
echo $_GET['validationToken'];
exit;
}
header('Content-Type: application/json');
$raw = file_get_contents('php://input');
$data = json_decode($raw, true);
if ($data && isset($data['value'])) {
foreach ($data['value'] as $change) {
$resource = $change['resource'] ?? '';
$changeType = $change['changeType'] ?? '';
error_log("Microsoft Graph Webhook: {$changeType} op {$resource}");
}
}
echo json_encode(['received' => true]);