Add an integration for Microsoft Teams.
Review Request #13742 — Created April 22, 2024 and submitted
This adds an integration for Microsoft Teams. Similar to our other chat
service integrations, this sends messages to channels in Microsoft Teams when
review requests are created, updated, and reviewed.We use Microsoft's Adaptive Card format for the messages. Unlike our other chat
integrations, with MS Teams there's unfortunately no ability to add an accent
colour to the message (typically we use yellow, green, and red accents as
a visual indicator for the tone of a message). The styling of the messages
also differ between the MS teams desktop and mobile apps, but this is a
choice by Microsoft and out of our control.Based on work by Hailan Xu (/r/11227/).
Ran unit tests.
Manually tested on RB5, RB6 and RB7:
- Creating the integration.
- New review requests, with/without diffs and files.
- Updates to review requests.
- Reviews with/without comments, issues, ship its.
- Replies.
- Tested that text which contains Markdown characters
gets properly escaped when being formatted in a link
in a message.
- Tested that URLs which contain ( or ) gets properly
escaped when being formatted in a link in a message.
Summary | ID |
---|---|
26ac22edc2755ce6002f5946f5f69543858fc9bd |
Description | From | Last Updated |
---|---|---|
Typo in the description on the second line: "intergrations" -> "integrations". |
chipx86 | |
Hmm. Is it possible to scale down the logo here so it doesn't get cropped? |
david | |
This doesn't have to wrap. |
david | |
For things that are purely annotations, we can use list instead of List (as long as we make sure to … |
david | |
We can use dict here. Why the type: ignore? |
david | |
This is missing a Version Added. |
chipx86 | |
As currently set up, we're including the URL as part of the localized string. Maybe that's okay, but it's also … |
chipx86 | |
Extra space after the comma. |
chipx86 | |
Missing Version Added. |
chipx86 | |
Mentioned this in the base typing change, but we should opt to use Sequence unless we need to mutate a … |
chipx86 | |
What's the type checker upset about? If it's thinking it may be a Sequence and not a List, then maybe … |
chipx86 | |
Let's sort these alphabetically. |
chipx86 | |
While I don't think we do this elsewhere, we may want to think about issues surrounding either the text or … |
chipx86 | |
4.0 |
chipx86 | |
Missing Version Added. |
chipx86 | |
line too long (81 > 79 characters) Column: 80 Error code: E501 |
reviewbot | |
line too long (81 > 79 characters) Column: 80 Error code: E501 |
reviewbot | |
To avoid the double-pass through the string, we can do this: escape_map = { '(': '%28', ')': '%29', } path … |
chipx86 |
- Commits:
-
Summary ID ff32934f5748634cbf0a14961677f0e7410e739b 3d6ec599fea4cd86b5683776b74f30492e5db28b
Checks run (2 succeeded)
- Change Summary:
-
- Add better typing.
- Update according to the keyword arguments change from /r/13749.
- Add a unit test for when MS Teams attempts to send a notification when no webhookURL is configured.
- Commits:
-
Summary ID 3d6ec599fea4cd86b5683776b74f30492e5db28b 0af7fb17c5ed6572a04cd20ddcfa1a873eb876bc - Diff:
-
Revision 3 (+3218)
Checks run (2 succeeded)
- Change Summary:
-
- Use "WebHook" consistently.
- Commits:
-
Summary ID 0af7fb17c5ed6572a04cd20ddcfa1a873eb876bc 31d6dc67e6540b6e7ee03df834a3a1916d12a4f3 - Diff:
-
Revision 4 (+3218)
Checks run (2 succeeded)
-
-
-
-
As currently set up, we're including the URL as part of the localized string. Maybe that's okay, but it's also kind of annoying for localization. But then, we can't lazily-evaluate this here.
(Also I don't trust this URL to be permanently correct.)
Wonder if we should continue to do this but link to the integrations entry and have a section on this there instead, which could at least link to the above URL.
-
-
-
Mentioned this in the base typing change, but we should opt to use
Sequence
unless we need to mutate a list. -
What's the type checker upset about?
If it's thinking it may be a
Sequence
and not aList
, then maybe it's worth putting together the column as aJSONList
first, and then buildingpre_text_card
using those. -
-
While I don't think we do this elsewhere, we may want to think about issues surrounding either the text or the URL breaking out of the
[...](...)
. We may have to escape them. -
-
- Change Summary:
-
- Updated comment about ignoring type for
icon_static_urls
(attribute -> property thing). - Link to our own docs in MS Teams integration config pages.
- Changed the way I build
pre_text_card
to satisfy type checker. - Escapes the text and URL when formatting Markdown links.
- Updated comment about ignoring type for
- Description:
-
This adds an integration for Microsoft Teams. Similar to our other chat
~ service intergrations, this sends messages to channels in Microsoft Teams when ~ service integrations, this sends messages to channels in Microsoft Teams when review requests are created, updated, and reviewed. We use Microsoft's Adaptive Card format for the messages. Unlike our other chat
integrations, with MS Teams there's unfortunately no ability to add an accent colour to the message (typically we use yellow, green, and red accents as a visual indicator for the tone of a message). The styling of the messages also differ between the MS teams desktop and mobile apps, but this is a choice by Microsoft and out of our control. ~ Based on work by Hailan Xu (/r/11227/)
~ Based on work by Hailan Xu (/r/11227/).
- Testing Done:
-
Ran unit tests.
Manually tested on RB5, RB6 and RB7:
- Creating the integration. - New review requests, with/without diffs and files. - Updates to review requests. - Reviews with/without comments, issues, ship its. ~ - Replies. ~ - Replies. + - Tested that text which contains Markdown characters + gets properly escaped when being formatted in a link + in a message. + - Tested that URLs which contain ( or ) gets properly + escaped when being formatted in a link in a message. - Commits:
-
Summary ID 31d6dc67e6540b6e7ee03df834a3a1916d12a4f3 c1886bd3777b5e091f361f410e28758614bbd960 - Diff:
-
Revision 5 (+3384 -16)
- Change Summary:
-
Fixed a couple lines that were too long.
- Commits:
-
Summary ID c1886bd3777b5e091f361f410e28758614bbd960 51e0f45eeec9106cd69051382f42457f100f8052 - Diff:
-
Revision 6 (+3388 -16)
Checks run (2 succeeded)
- Change Summary:
-
- Instead of linking directly to MS Teams docs, links to our RB website instead.
- Added new versions of the MS Teams icons.
- Commits:
-
Summary ID 51e0f45eeec9106cd69051382f42457f100f8052 de6e2675fab4375cb3d24f809109f5d4280a3166 - Diff:
-
Revision 7 (+3388 -16)
Checks run (2 succeeded)
- Commits:
-
Summary ID de6e2675fab4375cb3d24f809109f5d4280a3166 26ac22edc2755ce6002f5946f5f69543858fc9bd - Diff:
-
Revision 8 (+3404 -16)