Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 从azure部署的bot向ms团队发送主动消息_C#_Botframework_Microsoft Teams - Fatal编程技术网

C# 从azure部署的bot向ms团队发送主动消息

C# 从azure部署的bot向ms团队发送主动消息,c#,botframework,microsoft-teams,C#,Botframework,Microsoft Teams,我已经将bot部署到azure,当连接到azure中的ms团队频道时,我能够ping bot并接收消息,这很好。 我还在bot中添加了一个主动消息传递功能,在该功能中,频道中每一分钟都会触发一条消息 它在emulator中工作,但在webchat和MS团队中不工作: 未触发通知程序控制器 你能帮我一下吗? 我已经在GITHUB中上传了代码: 一分钟后,应在通道中触发以下消息: await turnContext.SendActivityAsync(MessageFactory.Text($"

我已经将bot部署到azure,当连接到azure中的ms团队频道时,我能够ping bot并接收消息,这很好。 我还在bot中添加了一个主动消息传递功能,在该功能中,频道中每一分钟都会触发一条消息

它在emulator中工作,但在webchat和MS团队中不工作: 未触发通知程序控制器

你能帮我一下吗? 我已经在GITHUB中上传了代码:

一分钟后,应在通道中触发以下消息:

await turnContext.SendActivityAsync(MessageFactory.Text($"Hello!" + Environment.NewLine + $"Trust you are well" + Environment.NewLine + $"Hope that you are having a good day" + Environment.NewLine + $"We are contacting you concerning lea access requests" + Environment.NewLine + $"Could you please review the following tasks if any and add the required information!"), cancellationToken);
//await turnContext.SendActivityAsync(MessageFactory.Text($"Please type ok to continue!"), cancellationToken);
await turnContext.SendActivityAsync(MessageFactory.Text("Could you please click on the below button to continue?"));

var card = new HeroCard
{
    //Text = "Could you please click on the below button to continue?",
    Buttons = new List<CardAction>
        {
            new CardAction(ActionTypes.ImBack, title: "lea access request", value: "lea access request"),
        },
};
var reply = MessageFactory.Attachment(card.ToAttachment());
await turnContext.SendActivityAsync(reply, cancellationToken);
Wait turnContext.SendActivityAsync(MessageFactory.Text($“Hello!”+Environment.NewLine+$“相信你一切都好”+Environment.NewLine+$“希望你过得愉快”+Environment.NewLine+$“我们正在就lea访问请求与你联系”+Environment.NewLine+$“请检查以下任务(如果有)并添加所需信息!”),cancellationToken);
//Wait turnContext.SendActivityAsync(MessageFactory.Text($“请键入ok以继续!”),cancellationToken);
等待turnContext.SendActivityAsync(MessageFactory.Text(“您能单击下面的按钮继续吗?”);
var卡=新卡
{
//Text=“您可以单击下面的按钮继续吗?”,
按钮=新列表
{
新的CardAction(ActionTypes.ImBack,标题:“lea访问请求”,值:“lea访问请求”),
},
};
var reply=MessageFactory.Attachment(card.ToAttachment());
等待turnContext.SendActivityAsync(回复、取消令牌);

我通过电子邮件提到了这一点,但我会将其转发给其他人:

您的主动消息在Emulator中工作,但在团队中不工作,因为您只在
EchoBot.OnConversationUpdateActivityAsync
中添加了一个
ConversationReference


如前所述,团队仅在安装bot或用户第一次与bot通话时发送对话更新。这是一种测试方法。

我已将对话引用添加到onmessageasync。受保护的覆盖异步任务OnMessageActivityAsync(iTurContext turnContext,CancellationToken CancellationToken){AddConversationReference(turnContext.Activity作为活动);System.Timers.Timer checkForTime=新的System.Timers.Timer(间隔60分钟);checkForTime.Appeased+=新的ElapsedEventHandler(checkForTime_Appeased);checkForTime.Enabled=true;这是因为我的机器人不是第一次在团队中使用吗?是否有可能让人就这些问题进行屏幕共享。如你所知,我从上一周就一直在使用它?谢谢
await turnContext.SendActivityAsync(MessageFactory.Text($"Hello!" + Environment.NewLine + $"Trust you are well" + Environment.NewLine + $"Hope that you are having a good day" + Environment.NewLine + $"We are contacting you concerning lea access requests" + Environment.NewLine + $"Could you please review the following tasks if any and add the required information!"), cancellationToken);
//await turnContext.SendActivityAsync(MessageFactory.Text($"Please type ok to continue!"), cancellationToken);
await turnContext.SendActivityAsync(MessageFactory.Text("Could you please click on the below button to continue?"));

var card = new HeroCard
{
    //Text = "Could you please click on the below button to continue?",
    Buttons = new List<CardAction>
        {
            new CardAction(ActionTypes.ImBack, title: "lea access request", value: "lea access request"),
        },
};
var reply = MessageFactory.Attachment(card.ToAttachment());
await turnContext.SendActivityAsync(reply, cancellationToken);