如何通过机器人真正向团队中的用户发送消息 [英] How to really send a message to a user in Teams through a bot

查看:59
本文介绍了如何通过机器人真正向团队中的用户发送消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近几天,我检查了数十个示例,文档,博客文章,youtube视频(课程,我不能接受),我可以说我仍然感到困惑,并且我仍然没有Teams机器人.我检查过的每个示例在方法上都不同,现在我可以确定还有很多其他示例.

常见问题:必需的输入/参数,例如服务网址,对话ID,.1.您找不到它们的解释.2.您找不到找到解释如何获得它们的地方.

我想实现的目标

我想要一个具有API的Teams机器人,并带有2个参数:用户电子邮件,消息.机器人必须将消息发送给指定的用户.就是这样.

我正在寻找方法:

  1. 创建/设置应用程序
  2. 创建实际的机器人
  3. 将应用程序安装到Teams

解决方案

我曾经创建过一个Teams对话机器人.希望我的经验能对您有所帮助.

首先,

现在向机器人发送"hello",您将获得默认结果.当您获得以下图片时,表明您已进行了正确的配置.

下一步是将该机器人添加到Teams客户端.首先,我将Teams Channel添加到我在azure门户中创建的机器人中.

然后,我需要修改清单文件.替换"YOUR-MICROSOFT-APP-ID".与appId刚刚创建.然后创建 manifest.zip 文件,其中包含TeamsAppManifest文件夹中的三个文件.

下一步是将zip文件上传到Teams客户端.单击左下角的应用程序",然后单击左面板底部的上传自定义应用程序",然后单击添加.好的,现在我有了一个团队对话机器人.

The last few days, I checked dozens of samples, docs, blog posts, youtube videos (courses, that I couldn't fine) and I can say I'm still confused and I still without a Teams bot. Every example I've checked is different in approach, and now I'm pretty sure there are many others like me.

Frequently problems: required input/parameters like service Url, conversation Id, etc. 1. You can't find a explanation for them. 2. You can't find a place where it's explained how to get them.

What I want to achieve

I want a bot on Teams, with a API, with 2 parameters: user email, message. The bot has to send the message to the specified user. That's it.

I'm looking how to:

  1. Create/Setup the Application
  2. Create the actual Bot
  3. Install the application to Teams

解决方案

I used to create a Teams conversation bot. Hope my experience will help you.

First, download sample provided by microsoft. I uses c# to create this bot, so I copy the '57.teams-conversation-bot' folder and opened it with vs studio. In this sample, I need to modify the configuration in appsettings.json. I need to enter the appid and apppassword.

So the next step is creating an Azure ad application in Azure portal. But if you never create Bot Framework registration resource before, you can create the azure ad application when you create a Bot Framework.By the way, You can leave 'Messaging endpoint' empty now. Please note, when you creating Azure ad application, you can choose to set this application as a multitenant app if your account creating the app is in a different tenant with your teams account.

Now I have a bot framework and an Azure ad app, I can modify appsettings.json, enter the appId and app password. I can get appId in app overview page and get app password when creating client secrets in Certificates & secrets tag.

Now, I need to debug my sample with web chat in the azure portal(Enter the bot framework created just now, you can see Tag 'Test in web chat' in the left panel). So I need to use ngrok to make the bot visit my code in local environment. Running the sample by pressing F5 in vs studio. Opening ngrok.exe and running the command ngrok http -host-header=rewrite 3978. Then I can get a https url, copy that and paste in the 'Messaging endpoint'. Don't forget to add '/api/messages'.

Now sending 'hello' to the bot and you will get default result. When you get the picture below, it means you have made a correct configuration.

Next step is to add this bot to Teams client. First, I add the Teams Channel in the bot I created in the azure portal.

Then I need to modify the manifest file. Replacing the "YOUR-MICROSOFT-APP-ID" with appId creating just now. And creating manifest.zip file which contains the three file in folder TeamsAppManifest.

Next step is uploading the zip file to Teams client. Click the 'Apps' in the lower-left corner and click the 'Upload the custom app' in the bottom of the left panel, then click add. Ok, now I get a team conversation bot.

这篇关于如何通过机器人真正向团队中的用户发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆