I have a bot built using ms bot v3 nodejs sdk. I add this bot in my MS team by using deep link for 1:1 conversation which looks like as follows
https://teams.microsoft.com/l/chat/0/0?users=28:{BotID}
I would like to add #mentioning users capability to this bot and I was trying to see if I can get some examples on how to it ?
Not sure if side loading bot as an app will allow it.
Bots and users can only at-mention members of the same conversation.
In a channel, you can mention any user in the team
In a 1:1 chat, you can at-mention the other user
In a group chat, you can mention any user in the chat
Right now neither bots nor users can at-mention arbitrary users who are not members of the conversation.
Your example above, "Hello #PersonB and #PersonC please take care of this ticket", can work if PersonB and PersonC are part of the team (if this in channel), or the group chat, but not in a 1:1 chat with the bot.
The deeplink in your question creates a 1:1 chat w/ the bot, so no other users could be at-mentioned :(
Bots in single user conversations do not require an # mention - the user can just type the command. Bots in channel conversations require the user to # mention the bot to invoke it in a channel.
In order to access your bot into channel, you need to add teams scope to your bot in App Manifest. Please use Teams App Studio to create your app manifest. You need to Upload an app package to Microsoft Teams to see your app.
You can upload your bot as a app, for that you need to create an app manifest in JSON format like this.
{
"$schema": "https://statics.teams.microsoft.com/sdk/v1.3.0-beta.2/manifest/MicrosoftTeams.schema.json",
"manifestVersion": "1.3",
"version": "1.3",
"id": "c9edb618-c5de-4be2-**f4-74c1*******1",
"packageName": "com.example.tcafebot",
"developer": {
"name": "Harsh Raj",
"websiteUrl": "https://www.sdharshraj.github.io",
"privacyUrl": "https://privacy.microsoft.com/en-us/privacystatement",
"termsOfUseUrl": "https://www.botframework.com/Content/Microsoft-Bot-Framework-Preview-Online-Services-Agreement.htm"
},
"name": {
"short": "TCafeBot",
"full": "Tea and Coffee bot"
},
"description": {
"short": "TCafeBot - a bot helping you with twiter.",
"full": "It will help you find a user or tweets from twiter. Also it can read text from image or even it can tell what is there in a photo."
},
"icons": {
"outline": "bot_blue.png",
"color": "bot_blue.png"
},
"accentColor": "#0079bf",
"configurableTabs": [{
"configurationUrl": "https://contoso.com/teamstab/configure",
"canUpdateConfiguration": true,
"scopes": [
"team",
"groupchat"
]
}],
"staticTabs": [{
"contentUrl": "https://harshcognitivebot.azurewebsites.net/loading",
"entityId": "1on1test123",
"name": "Bot Info",
"scopes": [
"team",
"personal"
]
},
{
"contentUrl": "https://harshcognitivebot.azurewebsites.net/tab-auth/simple",
"entityId": "simpleAuth",
"name": "Simple Auth",
"scopes": [
"personal"
]
},
{
"contentUrl": "https://harshcognitivebot.azurewebsites.net/tab-auth/silent",
"entityId": "silentAuth",
"name": "Silent Auth",
"scopes": [
"personal"
]
}
],
"bots": [{
"botId": "c9edb618-c5de-4be2-**f4-74c1*******1",
"scopes": [
"team",
"personal",
"groupchat"
],
"commandLists": [{
"scopes": [
"team"
],
"commands": [{
"title": "hello",
"description": "Runs the simplest hello dialog"
}
]
},
{
"scopes": [
"personal"
],
"commands": [{
"title": "hello",
"description": "Runs the simplest hello dialog"
}
]
}
]
}],
"composeExtensions": [{
"botId": "c9edb618-c5de-4be2-**f4-74c1*******1",
"canUpdateConfiguration": true,
"commands": [{
"id": "search123",
"description": "Find a card",
"title": "Search",
"initialRun": true,
"parameters": [{
"title": "query123",
"name": "query",
"description": "Search string"
}]
}]
}],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
"787c30bb.ngrok.io"
]
}
And also keep a icon with the name given in the Manifest file.
Then you need to make a zip file of these two files(Manifest and Icon). Note that these two file should not be in any folder you should make a zip directly with the two files.
Then Go to Team App and select upload a custom app there you can browse your zip file.
Also for fetching team details you can refer this Link
To use #mention, add your bot to a Teams channel:
Use Teams App Studio to create an App Manifest zip file. Details here.
Upload the App Manifest zip file to the Teams channel. Go to the Teams channel -> Manage Team -> Apps -> Upload a Custom App link (at the bottom)
Your bot is now available in the channel, and users can talk to it using #mention.
Important tip for bots in Teams - Remove the #mention once the text is received by the Bot (in MessageController.cs), before it is sent to LUIS etc
if (activity.ChannelId == ChannelIds.Msteams)
{
//remove bot #mention
if (activity.Text.Contains("<at>"))
{
activity.Text = Regex.Replace(activity.Text, "<at>.*</at>", "", RegexOptions.IgnoreCase).Trim();
}
}
Related
I have an Azure bot that we are using to build a message extension functionality in Microsoft Teams.
Users access it via the conversation feature in team channel. It works by taking a search string entered by a user in the message extension, searching our database for matching entries, and once an entry is selected posting a message into a team channel linking to the resource.
It is working as expected in all environments except for Production, where we see the following behaviour:
Some search strings return the expected ("nothing found") response
But most search strings return a 502 error. The bot's log says "The bot is not part of the conversation roster"
We are sideloading the manifest for the bot and its associated tab app. As far as I can tell, there are no differences in bot or app setup between Production and the other apps we setup (QA, staging, etc)
I've checked the other SO posts and those on the Microsoft PowerUsers forum. They mostly say that the bot needs to be added to Teams in Azure, but this has been done. And it's working for all of our environments except for Production...
This is the manifest. It references the eduMe app already published in AppSource:
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.11/MicrosoftTeams.schema.json",
"manifestVersion": "1.11",
"version": "1.1.3",
"id": "28beac77-2765-4248-8a25-02779d7242ca",
"packageName": "com.microsoft.teams.extension",
"developer": {
"name": "eduMe",
"websiteUrl": "https://edume.com",
"privacyUrl": "https://edume.com",
"termsOfUseUrl": "https://edume.com"
},
"icons": {
"color": "resources/edume-hexamark.png",
"outline": "resources/edume-outline-hexamark.png"
},
"name": {
"short": "eduMe Beta_test2",
"full": "eduMe Beta_test2"
},
"description": {
"short": "Giving the deskless workforce seamless access to relevant knowledge",
"full": "Training your workforce doesn't need to be painful. No more clunky authoring tools and dated, desktop based learning. eduMe helps you deliver the training when and where your workforce need it."
},
"accentColor": "#F3F3FF",
"bots": [
{
"botId": "e9aa4df6-ed17-423f-bb7a-5cb1f6f090d7",
"scopes": ["personal", "team", "groupchat"],
"supportsFiles": false,
"isNotificationOnly": true
}
],
"composeExtensions": [
{
"botId": "29b96f25-2032-4fa4-8abd-5ac8f652699f",
"commands": [
{
"id": "searchQuery",
"context": ["compose", "commandBox"],
"description": "Command to search courses.",
"title": "Search",
"type": "query",
"parameters": [
{
"name": "searchQuery",
"title": "Search Query",
"description": "Your search query",
"inputType": "text"
}
]
}
]
}
],
"configurableTabs": [
{
"configurationUrl": "https://edume-ms-teams.herokuapp.com/index.html#/config",
"canUpdateConfiguration": true,
"scopes": ["team", "groupchat"]
}
],
"staticTabs": [
{
"entityId": "index",
"name": "Home",
"contentUrl": "https://edume-ms-teams.herokuapp.com/index.html#/tab",
"websiteUrl": "https://edume-ms-teams.herokuapp.com/index.html#/tab",
"scopes": ["personal"]
}
],
"permissions": ["identity", "messageTeamMembers"],
"validDomains": [
"localhost",
"*.microsoftonline.com",
"*.herokuapp.com",
"*.botframework.com",
"edume.com"
],
"webApplicationInfo": {
"id": "29b96f25-2032-4fa4-8abd-5ac8f652699f",
"resource": "api://edume-ms-teams.herokuapp.com/29b96f25-2032-4fa4-8abd-5ac8f652699f"
}
}
We have a Microsoft app which we created, installed on our tenant (tenant app, not sideloaded).
I cannot:
Uninstall the app
Update the app with a new version number
I have all permissions to do so and my account is the installing account.
The manifest was built using App Studio.
I also have a related problem: the app is still usable even though it is not installed in any team. The app does not appear in the "Personal apps" tab or the Applications tab when clicking the three dots in the left side panel of Microsoft Teams.
Permissions:
Manifest:
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.5/MicrosoftTeams.schema.json",
"manifestVersion": "1.5",
"version": "1.0.2",
"id": "<APP_ID>",
"packageName": "com.heyaxel.axel",
"developer": {
"name": "HeyAxel",
"websiteUrl": "https://heyaxel.com",
"privacyUrl": "https://www.heyaxel.com/files/Privacy_Policy.pdf",
"termsOfUseUrl": "https://www.heyaxel.com/files/Privacy_Policy.pdf"
},
"icons": {
"color": "color.png",
"outline": "outline.png"
},
"name": {
"short": "Axel",
"full": "Axel"
},
"description": {
"short": "Axel offers new hires perfect success conditions and saves managers' time",
"full": "Axel is a virtual assistant who offers the perfect success conditions to your new hires while saving time for busy managers.\nAxel transforms best onboarding practices into automated processes in your organisation. He helps managers:\n- Engage with their new hire before their arrival\n- Set tangible goals and monitor their progress\n- Save time by automating recurrent tasks, such as scheduling meetings\nOn average, Axel reduces the time-to-productivity of new employees by a third."
},
"accentColor": "#F9F9FA",
"bots": [
{
"botId": "61510758-1c2d-468f-ba41-6890b788fa16",
"scopes": [
"team",
"personal"
],
"supportsFiles": true,
"isNotificationOnly": false
}
],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
"<ALLOWED_DOMAINS>"
]
}
We have a sideloaded Microsoft Teams bot (called Axel), fully operational and running in production. The bot is able to send messages (including proactive), receive messages, etc.
However, users cannot initiate a conversation with the bot -- the bot MUST send a message first for it to work. I believe this is not expected / desired behavior. When searching for the bot in the search tab, we find it, but when clicking on its name nothing happens.
How can we make it possible for users to initiate conversations with the bot?
Edit: here is our redacted manifest.json file
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.3/MicrosoftTeams.schema.json",
"manifestVersion": "1.3",
"version": "1.0.0",
"id": "{app_id}",
"packageName": "com.package.name",
"developer": {
"name": "HeyAxel",
"websiteUrl": "https://heyaxel.com",
"privacyUrl": "https://www.heyaxel.com/files/Privacy_Policy.pdf",
"termsOfUseUrl": "https://www.heyaxel.com/files/Privacy_Policy.pdf"
},
"icons": {
"color": "color.png",
"outline": "outline.png"
},
"name": {
"short": "Axel",
"full": "Axel"
},
"description": {
"short": "shortdesc",
"full": "fulldesc"
},
"accentColor": "#F9F9FA",
"bots": [
{
"botId": "{bot_id}",
"scopes": [
"team"
],
"supportsFiles": true,
"isNotificationOnly": false
}
],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
"{domain1}",
"{domain2}"
]
}
Translation of scopes:
Receive messages & data from me
Send me messages & notification
Access profile info
Receive messages & data from users in channels
Send messages & notifications in a channel Access team information
Your bot only has the "team" scope enabled.
Open your manifest.json in App Studio.
Go to the Bots section
Click Edit
Enable the Personal scope
Alternatively, you can just add the scope manually, then re-sideload/publish your bot.
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.3/MicrosoftTeams.schema.json",
"manifestVersion": "1.3",
"version": "1.0.0",
"id": "{app_id}",
"packageName": "com.package.name",
"developer": {
"name": "HeyAxel",
"websiteUrl": "https://heyaxel.com",
"privacyUrl": "https://www.heyaxel.com/files/Privacy_Policy.pdf",
"termsOfUseUrl": "https://www.heyaxel.com/files/Privacy_Policy.pdf"
},
"icons": {
"color": "color.png",
"outline": "outline.png"
},
"name": {
"short": "Axel",
"full": "Axel"
},
"description": {
"short": "shortdesc",
"full": "fulldesc"
},
"accentColor": "#F9F9FA",
"bots": [
{
"botId": "{bot_id}",
"scopes": [
"team",
"personal",
"groupchat"
],
"supportsFiles": true,
"isNotificationOnly": false
}
],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
"{domain1}",
"{domain2}"
]
}
Also, be sure that you've enabled the Teams Channel by going to:
Azure Portal
Your Resource Group
Your Web App Bot or Bot Channels Registration Service
Channels
Enable the Teams Channel
I had created an Office365 Connector for my Microsoft Teams app. Earlier it was working perfect, I was getting notifications in my channel.
Now it has stopped working. I am getting "Something went wrong" error with message "An unexpected error has occurred". something went wrong
Any help regarding this would be appreciated. I am really stuck.
Manifest content :
{
"$schema": "https://statics.teams.microsoft.com/sdk/v1.0/manifest/MicrosoftTeams.schema.json",
"manifestVersion": "1.0",
"version": "1.1",
"id": "8471589f-f521-4d69-8d59-6a207b9e1b7b",
"packageName": "com.microsoft.teams.corrus",
"developer": {
"name": "Corrus",
"websiteUrl": "https://corrus.com/",
"privacyUrl": "https://corrus.com/terms/",
"termsOfUseUrl": "https://corrus.com/terms/"
},
"icons": {
"color": "corrus_logo.png",
"outline": "corrus_logo_outline.png"
},
"name": {
"short": "Corrus",
"full": "Corrus"
},
"description": {
"short": "A work management platform to work collaboratively and accomplish goals.",
"full": "Corrus is a work management tool for small teams to collaborate and manage projects in a cloud application. You can create tasks, build workflows and work with different stakeholders in one workspace. It helps teams align their processes and scale better as it enables them to break their goals and work into manageable blocks, create an action plan or a workflow, increase productivity and gain visibility within the team."
},
"accentColor": "#8170FF",
"configurableTabs": [
{
"configurationUrl": "https://app.corrus.com/#/tabsConfig",
"canUpdateConfiguration": true,
"scopes": [
"team"
]
}
],
"connectors": [
{
"connectorId": "8471589f-f521-4d69-8d59-6a207b9e1b7b",
"scopes": [
"team"
]
}
],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
"app.corrus.com",
"corrus.com"
]
}
There was an issue when we try to configure connector for newly created team. This issue has been fixed.
Note: Adding this as answer from comments section for visibility.
I have tried to integrate a card bot with teams, but bot is not replying also in bot emulator ,while same bot is replying in https://dev.botframework.com/bots/ and bot service of azure.code is same as BotBuilder-Sample inside that cards-Adaptivecards.Only change i have done is
// Create chat bot and listen to messages
var connector = new builder.ChatConnector({
appId: "628d8adc-3196-405d-87f6-d94ebfd3c511",
appPassword: "gqihkQISB5~crWKP5463|}_"
}); harded coded appId and password.
The Bot State API is deprecated. Please refer to aka.ms/I6swrh for details on how to replace with your own storage. And error ocurred Error: GET to 'b23cc4c1.ngrok.io/v3/botstate/emulator/users/default-user'; failed: [402] Payment Required at Request._callback (C:\Users\WittyParrot\Documents\card-adaptive\node_modules\botbuilder\lib\bots\ChatConnector.js:559:46) at Request.self.callback (C:\Users\WittyParrot\Documents\card-adaptive\node_modules\request\request.js:186:22) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7)
Manifest:
{
"$schema": "https://statics.teams.microsoft.com/sdk/v1.2/manifest/MicrosoftTeams.schema.json",
"manifestVersion": "1.2",
"version": "1.0.0",
"id": "89d4a972-fad6-41ce-9f0f-aaae569cd6ed",
"packageName": "Hotel-finder",
"developer": {
"name": "Lalit",
"websiteUrl": "https://www.microsoft.com",
"privacyUrl": "https://www.microsoft.com/privacy",
"termsOfUseUrl": "https://www.microsoft.com/termsofuse"
},
"icons": {
"color": "contoso96x96.png",
"outline": "contoso20x20.png"
},
"name": {
"short": "Hotel App ",
"full": "Hotel finder"
},
"description": {
"short": "hotel finder",
"full": "Bot find hotels"
},
"accentColor": "#FFFFFF",
"bots": [
{
"botId": "628d8adc-3196-405d-87f6-d94ebfd3c511",
"scopes": [
"team",
"personal"
]
}
],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": []
}
Per Adaptive Cards for Bot Developers:
Skype and Microsoft Teams are not yet supported in the current preview, but we're working on it! Please see the Channel Status section below for details.
And:
Microsoft Teams: Full support coming soon
In the meantime, Adaptive Cards will not display in Microsoft Teams. The 402 error sounds like a different issue.