1- # MS Teams Integration
1+ # MS Teams Integration
22
3- As a messaging integration, it provides for features beyond OAuth; notably,
4- interactive callbacks for login and replies. As such it a bot resource is needed
5- on Azure, along with the connector which brings the bot into MS Teams. The
6- CodeStream API serves as the bot, providing an endpoint for interactive
7- callbacks.
3+ As a messaging integration, it provides for features for, interactive callbacks
4+ for login and replies. As such it a bot resource is needed on Azure, along with
5+ the connector which brings the bot into MS Teams. The CodeStream API serves
6+ as the bot, providing an endpoint for interactive callbacks.
87
98* [ Resource & MST Installation] ( #create-resources--install )
109* [ Bot Development Notes] ( #developing )
@@ -59,19 +58,19 @@ environment.
5958 * The ** appClientSecret** ** Certificates & Secrets** blade. The secret
6059 that came with the bot is hidden so you'll need to create a new one.
6160 (You can also delete the old one)
62- ```
63- {
64- "integrations": {
65- "msteams": {
66- "cloud": {
67- "appClientId": "<application-cliend-id-from-Overview-blade>",
68- "appClientSecret": "<secret-from-certificates-and-secrets-blade>"
69- }
70- }
71- }
72- }
73- ```
7461
62+ ``` json
63+ {
64+ "integrations" : {
65+ "msteams" : {
66+ "cloud" : {
67+ "appClientId" : " <application-cliend-id-from-Overview-blade>" ,
68+ "appClientSecret" : " <secret-from-certificates-and-secrets-blade>"
69+ }
70+ }
71+ }
72+ }
73+ ```
7574
7675### Create & Install the MS Teams App Package
7776
@@ -92,8 +91,9 @@ registration.
9291
93921 . To create an App package (zip file) using the default manifest template
9493 `$CS_API_TOP/etc/msteamsbot/template/manifest.json`:
95- ```
96- $ cs_api-msteams_bot_app_pkg_creator -e <env> -b <appClientId>
94+
95+ ```bash
96+ cs_api-msteams_bot_app_pkg_creator -e <env> -b <appClientId>
9797 ```
9898
9999#### Install Package
@@ -109,43 +109,44 @@ registration.
109109
1101101 . Select a team / channel <br />
111111 <image src =" images/teams-select-channel.png " width =" 400 " /><br />
112-
113112
1141131 . In the ** Chat** window, you should see your newly added bot. For testing purposes type ` @yourbotname help ` . You should see a response from the bot with some help text. To begin using the feal functionality of your new bot, select your bot and ** connect** it to a channel by typing ` @yourbotname connect ` . Here, you're authenticating for the entire team; others should not have to repeat this step.
115114
116115#### Other Package Commands
117116
1181171 . Create a manifest file only (does not require dev_tools):
119- ```
120- $ cd .../codestream-server/api_server
121- $ node bin/cs_msteams_bot_manifest_creator.js -e <env> -b <bot-application-id>
118+
119+ ``` bash
120+ cd .../codestream-server/api_server
121+ node bin/cs_msteams_bot_manifest_creator.js -e < env> -b < bot-application-id>
122122 ```
123123
1241241 . Create App Packages for all managed environments and optionally distribute them
125125 to our CDN (you must have access to the secrets database and S3 asset
126126 distribution tree).
127+
128+ ``` bash
129+ cs_api-msteams_bot_app_pkg_creator --use-keydb [--distribute]
127130 ```
128- $ cs_api-msteams_bot_app_pkg_creator --use-keydb [--distribute]
129- ```
131+
130132 Once distributed, you can fetch the packages (except production) with:
131133 ` https://assets.codestream.com/mstbot/codestream-msteamsbot-<env>-<version>.zip `
132134 For production, use:
133135 ` https://assets.codestream.com/mstbot/codestream-msteamsbot-<version>.zip `
134136
135-
136137### Additional Publishing Documentation
137- https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/deploy-and-publish/appsource/publish
138138
139- https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/deploy-and-publish/appsource/prepare/overview
139+ [ https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/deploy-and-publish/appsource/publish ] ( https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/deploy-and-publish/appsource/publish )
140140
141+ [ https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/deploy-and-publish/appsource/prepare/overview ] ( https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/deploy-and-publish/appsource/prepare/overview )
141142
142143## Developing
143144
144145Use the App Studio app from within the Teams app to test your app's manifest, as
145146well as serve as a UI for editing it. From here, you can attach the bot, as well
146147as install it locally for testing
147148
148- https://aka.ms/InstallTeamsAppStudio
149+ [ https://aka.ms/InstallTeamsAppStudio ] ( https://aka.ms/InstallTeamsAppStudio )
149150
150151### Dev logic
151152
@@ -156,18 +157,20 @@ the glue that makes it work -- as it follows the notion of it being a
156157Teams Organization` from the codemark sharing dropdown.
157158
158159### Installing
160+
159161Upon installing the CodeStream bot, users in the team/channel for which the bot
160162was installed to will receive a personal greeting message about what CodeStream
161163offers. If the first command a user issues the bot in the personal channel is
162164any thing other than ` signin ` they will get an even more customized/personal
163165message telling them to issue the ` signin ` command to get started.
164166
165167### SignIn
168+
166169A user gets associated with CodeStream by signing into CodeStream via the web by
167170issuing the ` signin ` command from the personal CodeStream bot chat. This
168171eventually creates a ` signinToken ` which is tied to the CS ` userId ` , CS ` teamId `
169172and the MS Teams ` tenantId ` . If a user is on > 1 team, they will be able to able
170- to connect all the teams.
173+ to connect all the teams.
171174
172175When a CS team gets associated, we store on ` team ` an entry in
173176` providerIdentities ` in the format of ` msteams::<tenantId> ` and we store info
@@ -178,6 +181,7 @@ A reference to their CodeSteam userId is also stored in msteams_state, the
178181key/value store for MST data
179182
180183### Connecting
184+
181185Once a user has signed in, they can connect the bot to any team channel on any
182186team in any of the teams for that tenant. Upon connecting, we store a reference
183187to the MS Teams team in ` msteams_team ` , along with the _ conversation_ (aka
@@ -189,9 +193,11 @@ an accessToken, as we will be querying teams/conversations that are gathered
189193from the MS Teams CodeStream bot.
190194
191195## Bot Commands
196+
192197These are the commands that you can issue the CodeStream bot for msteams
193198
194- ### secret commands
199+ ### Secret Commands
200+
195201These are unlisted commands. There's nothing "secret" about that, just that
196202they're more intended for debugging rather than for a normal MS Teams user
197203
@@ -216,8 +222,8 @@ mapped in `msteams_conversations` (slightly descructive as it could affect other
216222team members, but it's a way to start "fresh" if a conversation was removed or
217223renamed)
218224
225+ ### Personal Channels
219226
220- ### personal channels
221227These commands can only be used when communicated 1-on-1 with the CodeStream
222228bot:
223229
@@ -232,6 +238,7 @@ Removes the CodeStream `msteams` provider from the user that ran the command.
232238This is the same as using the ` Disconnect <Provider> ` from the UI.
233239
234240### public channels
241+
235242These commands only work in public channels:
236243
237244``` connect ```
@@ -241,7 +248,8 @@ Adds this channel as a possible target for codemark sharing.
241248Removes this channel as a possible target for codemark sharing.
242249
243250### any channel
244- These commands work anywhere:
251+
252+ These commands work anywhere:
245253
246254``` help ```
247255shows a help screen
@@ -253,6 +261,7 @@ Every other command just else shows a generic message asking the user if they
253261need help.
254262
255263### CodeStream IDE
264+
256265When a user begins creating a codemark, we attempt to ` GET ` all the
257266conversations that they've connected via ` /msteams_conversations ` . We mix in the
258267` teamName ` from ` msteams_teams ` . When the codemark is created, we ` POST ` to
0 commit comments