@提及机器人女士与MS团队中的用户

时间:2018-09-25 02:59:41

标签: botframework microsoft-teams

我有一个使用ms bot v3 nodejs sdk构建的bot。我通过使用深层链接进行1:1对话,将该机器人添加到了我的MS团队中,如下所示

https://teams.microsoft.com/l/chat/0/0?users=28:{BotID}

我想在该机器人中添加@提及用户的功能,我试图查看是否可以找到有关该机器人的示例?

不确定将侧面加载的bot作为应用程序是否允许。

4 个答案:

答案 0 :(得分:0)

单用户对话中的机器人不需要@提及-用户只需键入命令即可。 Bots in channel conversations要求用户@提及该漫游器才能在频道中调用它。

要进入通道访问您的机器人,您需要在App Manifest中向您的机器人添加团队范围。请使用Teams App Studio创建您的应用清单。您需要Upload an app package to Microsoft Teams才能查看您的应用。

答案 1 :(得分:0)

您可以将机器人作为应用程序上传,为此您需要创建JSON格式的应用程序清单。

{
"$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"
]

}

并保留一个带有清单文件中给定名称的图标。

然后,您需要为这两个文件(清单和图标)创建一个zip文件。请注意,这两个文件不应位于任何文件夹中,而应直接使用这两个文件进行压缩。

然后转到Team App并选择上载自定义应用程序,在那里您可以浏览zip文件。

有关获取小组详细信息的信息,您可以参考此Link

答案 2 :(得分:0)

要使用@mention,请将您的漫游器添加到Teams频道:

使用Teams App Studio创建App Manifest zip文件。详细信息here

将App Manifest zip文件上传到Teams频道。转到团队频道->管理团队->应用程序->上载自定义应用程序链接(在底部)

您的漫游器现已在频道中可用,用户可以使用@mention与它对话。

团队中机器人的重要提示-一旦Bot接收到了@Messageion(在MessageController.cs中),然后将其发送给LUIS等

            if (activity.ChannelId == ChannelIds.Msteams)
            {
                //remove bot @mention
                if (activity.Text.Contains("<at>"))
                {
                    activity.Text = Regex.Replace(activity.Text, "<at>.*</at>", "", RegexOptions.IgnoreCase).Trim();
                }
            }

答案 3 :(得分:0)

机器人和用户只能提及同一对话的成员。

  • 在频道中,您可以提及团队中的任何用户
  • 在1:1聊天中,您可以提及其他用户
  • 在群聊中,您可以提及聊天中的任何用户

目前,僵尸程序和用户都无法提及不是对话成员的任意用户。

您上面的示例“您好@PersonB和@PersonC,请注意这张票”,如果PersonB和PersonC是团队的一部分(如果在频道中)或群聊,但不能在1中使用,则可以使用:1与漫游器聊天。

您问题中的深层链接会与漫游器建立1:1聊天,因此其他任何用户都不会受到关注:(