You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/includes/snippet-channeldata.md
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -456,6 +456,49 @@ This snippet shows an example of a `channelData` property that specifies a chann
456
456
}
457
457
```
458
458
459
+
## Adding a bot to Teams
460
+
461
+
Bots added to a team become another team member, who can be `@mentioned` as part of the conversation. In fact, bots only receive messages when they are `@mentioned`, so other conversations on the channel are not sent to the bot.
462
+
For more information, see [Channel and Group chat conversations with a Microsoft Teams bot](https://aka.ms/bots-con-channel).
463
+
464
+
Because bots in a group or channel respond only when they are mentioned (`@botname`) in a message, every message received by a bot in a group channel contains its own name, and you must ensure your message parsing handles that. In addition, bots can parse out other users mentioned and mention users as part of their messages.
465
+
466
+
### Check for and strip @bot mention
467
+
468
+
```csharp
469
+
470
+
Mention[] m=sourceMessage.GetMentions();
471
+
varmessageText=sourceMessage.Text;
472
+
473
+
for (inti=0;i<m.Length;i++)
474
+
{
475
+
if (m[i].Mentioned.Id==sourceMessage.Recipient.Id)
476
+
{
477
+
//Bot is in the @mention list.
478
+
//The below example will strip the bot name out of the message, so you can parse it as if it wasn't included. Note that the Text object will contain the full bot name, if applicable.
> Adding a bot by GUID, for anything other than testing purposes, is not recommended. Doing so severely limits the functionality of a bot. Bots in production should be added to Teams as part of an app. See [Create a bot](https://docs.microsoft.com/microsoftteams/platform/concepts/bots/bots-create) and [Test and debug your Microsoft Teams bot](https://docs.microsoft.com/microsoftteams/platform/concepts/bots/bots-test).
500
+
501
+
459
502
## Additional resources
460
503
461
504
-[Entities and activity types](../bot-service-activities-entities.md)
0 commit comments