feat(webhook): add reviewer name to MS Teams review request notifications#38289
feat(webhook): add reviewer name to MS Teams review request notifications#38289SudhanshuMatrix wants to merge 4 commits into
Conversation
|
Any UI example? |
|
@bircni Since MessageCards are a legacy format and Microsoft recommends using Adaptive Cards for new Microsoft Teams development, I couldn't find a way to preview the MessageCard JSON directly. As a workaround, I converted the MessageCard JSON payload into an Adaptive Card. The converted card renders successfully Do you happen to have access to a Microsoft Developer Sandbox or the credentials for one? If so, we could use it to test this in a Microsoft 365 environment. I applied for a Microsoft Developer Sandbox earlier, but it seems Microsoft isn't granting sandbox subscriptions to new users at the moment, so I wasn't able to get access. If you already have one available, it would be really helpful for testing. |
itxaiohanglover
left a comment
There was a problem hiding this comment.
Nice implementation — the variadic extraFacts ... refactoring is clean and the reviewer name fallback from FullName to UserName is correct. Test coverage for the review request case is good.
Include the full name in parentheses, if available instead of the fallback Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Signed-off-by: Shudhanshu Singh <sudhanshuwriterblc@gmail.com>
|
It would be great if this could be tested manually. Currently, the MessageCard JSON is converted to an Adaptive Card only to provide a rough preview. See the comment for more details: #38289 (comment). If anyone has access to a Microsoft Developer Sandbox (or other testing credentials), I'd really appreciate your help testing this. Alternatively, if someone can test it manually and confirm whether everything works as expected, that would be very helpful. Thanks! |
…links in MS Teams payloads - Format the Repository fact using the markdown link syntax with Repository HTML URL - Format the Pull Request fact using the markdown link syntax with Pull Request HTML URL and Index - Remove redundant Repository fact from Wiki webhook converter - Update MSTeams payload unit tests to expect the link formats
can't you just post it into your teams team? |
|
The issue poster is already helping (see #38270). I'm on Linux and only use the Teams web client, and I don't see any option there to post or preview MessageCard JSON. I don't know whether that is a web-client limitation, a tenant/permission restriction, or a premium feature. I attached an Adaptive Card preview earlier as a rough reference. |

Summary
Include the requested reviewer's username (along with their full name in parentheses, if available) and render the
RepositoryandPull requestfields as clickable links in Microsoft Teams webhook notifications.Fixes: #38270
Changes
services/webhook/msteams.go:createMSTeamsPayloadhelper function to globally format theRepository:fact as a clickable markdown link using the repository's full name and HTML URL.PullRequestconvertor to format the requested reviewer asUsername (Full Name)(falling back to justUsernameif the full name is empty) and append a newRequested Reviewer:fact when the action is a review request or removal.PullRequestandReviewconvertors to format thePull request:fact as a clickable markdown link using the PR index and HTML URL.Repository:fact from theWikiconverter since the shared helper now automatically generates the formatted link.services/webhook/msteams_test.go:Verification
go test ./services/webhook/