首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从bot框架仿真器向团队发送查询,并从各团队获得对bot框架模拟器的答复

从bot框架仿真器向团队发送查询,并从各团队获得对bot框架模拟器的答复
EN

Stack Overflow用户
提问于 2020-09-17 18:41:53
回答 1查看 108关注 0票数 1
  • 我想将我的bot仿真器连接到团队以发送一个查询(这是有效的)
  • 一旦我们收到了一个小组查询,查询的答案应该被发送回bot模拟器

我没有收到团队对机器人仿真器的答复

EN

回答 1

Stack Overflow用户

发布于 2020-11-18 19:15:11

要从网络聊天连接到我正在使用的以下代码组:

代码语言:javascript
复制
string teamsChannelId = "****************************";
string serviceUrl = "****************************";
string botClientID = "****************************";
string botClientSecret = "****************************";
MicrosoftAppCredentials.TrustServiceUrl(serviceUrl);
var connectorClient = new ConnectorClient(new Uri(serviceUrl), new MicrosoftAppCredentials(botClientID, botClientSecret));
var topLevelMessageActivity = MessageFactory.Text(saveconv);
var conversationParameters = new ConversationParameters
{
    IsGroup = true,
    ChannelData = new TeamsChannelData
    {
        Channel = new ChannelInfo(teamsChannelId),
    },
    Activity = topLevelMessageActivity
};
await connectorClient.Conversations.CreateConversationAsync(conversationParameters);

要从Microsoft团队发送响应到web聊天机器人,下面的代码工作如下:

代码语言:javascript
复制
var userAccount = new ChannelAccount(id: "userid", name: "username", role: "user", aadObjectId: null);
var botAccount = new ChannelAccount(id: "botid", name: "botname", role: "bot", aadObjectId: null);
string botClientID = "****************************";
string botClientSecret = "****************************";
string serviceUrl = "****************************";
MicrosoftAppCredentials.TrustServiceUrl(serviceUrl);
var connector = new ConnectorClient(new Uri(serviceUrl), new MicrosoftAppCredentials(botClientID, botClientSecret));
IMessageActivity message = Activity.CreateMessageActivity();
message.ChannelId = "channelid";
message.From = botAccount;
message.Recipient = userAccount;
message.Conversation = new ConversationAccount(id: "conversationid");
message.Text = "Reply from Microsoft Teams: *" + turnContext.Activity.Text;
message.Locale = "en-us";
await connector.Conversations.SendToConversationAsync((Activity)message);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63944378

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档