diff --git a/src/Support/NotificationPayloadFactory.php b/src/Support/NotificationPayloadFactory.php index 9bbe4cf..b30e87a 100644 --- a/src/Support/NotificationPayloadFactory.php +++ b/src/Support/NotificationPayloadFactory.php @@ -28,24 +28,50 @@ class NotificationPayloadFactory $teamsAppId = trim((string) $this->settings->get('sbp-jm-msteams-webhook.teams_app_id', '')); $iconId = trim((string) $this->settings->get('sbp-jm-msteams-webhook.icon_id', '')); - $payload = [ - 'topic' => [ - 'source' => 'text', - 'value' => 'Flarum Test', - 'webUrl' => 'https://teams.microsoft.com/l/entity/d92b1be6-ea92-46b1-bcb0-c08ffdd1a61a/8ffe419f-ca44> - ], - 'activityType' => 'systemDefault', - 'previewText' => [ - 'content' => 'Test aus Flarum', - ], - 'templateParameters' => [ - [ - 'name' => 'systemDefaultText', - 'value' => 'Test aus Flarum', - ], - ], + $discussionTitle = 'Backup-Strategie für Forum'; + $discussionUrl = 'https://forum.sbp.de/d/34-which-file-extensions-are-allowed-for-uploads/2'; + $previewSnippet = 'Bitte prüft, ob wir tägliche Snapshots brauchen.'; + $reasonText = 'Neue Antwort in beobachteter Diskussion'; - ]; + + + + //$discussionTitle = $discussionTitle ?? 'Neue Diskussion'; + //$discussionUrl = $discussionUrl ?? 'https://forum.sbp.de'; + //$previewSnippet = $previewSnippet ?? 'Neue Aktivität in Flarum'; + //$reasonText = $reasonText ?? 'Neue Antwort in beobachteter Diskussion'; + + // Teams-App-/Tab-Ziel aus deinem aktuellen Manifest: + $teamsManifestAppId = 'd92b1be6-ea92-46b1-bcb0-c08ffdd1a61a'; + $teamsEntityId = '8ffe419f-ca44-4627-a4b2-f223da2d07aa'; + + // Deep Link auf den Personal Tab in Teams. + // webUrl ist der Fallback und zeigt direkt auf die Flarum-Diskussion. + $teamsDeepLink = sprintf( + 'https://teams.microsoft.com/l/entity/%s/%s?webUrl=%s&label=%s', + rawurlencode($teamsManifestAppId), + rawurlencode($teamsEntityId), + rawurlencode($discussionUrl), + rawurlencode($discussionTitle) + ); + + $payload = [ + 'topic' => [ + 'source' => 'text', + 'value' => $discussionTitle, + 'webUrl' => $teamsDeepLink, + ], + 'activityType' => 'systemDefault', + 'previewText' => [ + 'content' => $previewSnippet, + ], + 'templateParameters' => [ + [ + 'name' => 'systemDefaultText', + 'value' => $reasonText, + ], + ], + ]; // if ($teamsAppId !== '') {