From c3fec7dde775f7dacac7cdd671409024cf3ed574 Mon Sep 17 00:00:00 2001 From: JM Date: Tue, 5 May 2026 16:58:59 +0200 Subject: [PATCH] andere app id --- src/Support/NotificationPayloadFactory.php | 65 +++++++++++----------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/src/Support/NotificationPayloadFactory.php b/src/Support/NotificationPayloadFactory.php index 367ba3e..01f5e8b 100644 --- a/src/Support/NotificationPayloadFactory.php +++ b/src/Support/NotificationPayloadFactory.php @@ -33,63 +33,62 @@ class NotificationPayloadFactory // $discussionUrl = $this->resolveSubjectUrl($blueprint) ?? 'https://forum.sbp.de'; // $previewSnippet = $this->buildPreviewText($blueprint); + // $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'; + + + + // // Freie Actor+Reason-Zeile für systemDefault + // $reasonText = match ($blueprint::getType()) { + // 'newPost' => 'There was a new answer in one of your folloed posts', + // 'postMentioned' => 'Your post has been mentioned', + // 'userMentioned' => 'You have been mentioned', + // 'postLiked' => 'Your post has been liked', + // default => 'New sbp forum update', + // }; $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'; + $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'; + // ✅ Teams AppCatalog ID (aus Get-TeamsApp) + $teamsCatalogAppId = '61e3fb91-4b17-428f-856b-51a345e10f06'; - - // Freie Actor+Reason-Zeile für systemDefault - $reasonText = match ($blueprint::getType()) { - 'newPost' => 'There was a new answer in one of your folloed posts', - 'postMentioned' => 'Your post has been mentioned', - 'userMentioned' => 'You have been mentioned', - 'postLiked' => 'Your post has been liked', - default => 'New sbp forum update', - }; - - // Teams-App-/Tab-Ziel aus deinem aktuellen Manifest - $teamsManifestAppId = 'd92b1be6-ea92-46b1-bcb0-c08ffdd1a61a'; - $teamsEntityId = '8ffe419f-ca44-4627-a4b2-f223da2d07aa'; - - $discussionTitle = 'Backup-Strategie für Forum'; - $discussionUrl = 'https://forum.sbp.de/d/34-which-file-extensions-are-allowed-for-uploads/2'; + // ✅ kompakte Unterseiten-ID (KEINE URL!) $subEntityId = 'discussion:34:2'; + // ✅ Kontext für entityUrl $contextJson = json_encode([ - 'subEntityId' => $subEntityId, + 'subEntityId' => $subEntityId ], JSON_UNESCAPED_SLASHES); - $teamsDeepLink = sprintf( - 'https://teams.microsoft.com/l/entity/%s/%s?tenantId=%s&webUrl=%s&label=%s&context=%s', - rawurlencode('d92b1be6-ea92-46b1-bcb0-c08ffdd1a61a'), - rawurlencode('8ffe419f-ca44-4627-a4b2-f223da2d07aa'), - rawurlencode('e2052793-a0f4-47d8-a3a3-52c926e79df5'), - rawurlencode($discussionUrl), - rawurlencode($discussionTitle), + // ✅ entityUrl (KEIN webUrl, KEIN Deep Link) + $entityUrl = sprintf( + 'https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/%s?context=%s', + rawurlencode($teamsCatalogAppId), rawurlencode($contextJson) ); - $payload = [ 'topic' => [ - 'source' => 'text', - 'value' => $discussionTitle, - 'webUrl' => $teamsDeepLink, + 'source' => 'entityUrl', + 'value' => $entityUrl, ], - 'activityType' => $activityType !== '' ? $activityType : 'systemDefault', + 'activityType' => 'systemDefault', 'previewText' => [ 'content' => mb_substr($previewSnippet, 0, 150), ], 'templateParameters' => [ [ - 'name' => 'systemDefaultText', + 'name' => 'systemDefaultText', 'value' => $reasonText, ], ], ]; + if ($iconId !== '') { $payload['iconId'] = $iconId; }