我目前正在批准将我的应用程序批准进入商店。其余问题之一是:
1. Employer and Employee both didn’t receive any notification in the channel bot
我的机器人目前在manifest.json中设置为notificationOnly
,因为我不需要/希望用户直接发送消息。
通过“主动消息传递”文档,对于哪些消息以及何时发送它们会通过上述故障,它有点模糊。
我需要将消息发送到频道吗?
我目前正在使用NodeJS
谢谢
这是一个很长的答案,涵盖了很多领域,仅仅因为我不是100%确定我知道你没有收到什么样的通知。如果没有回复,请在您的问题中添加其他详细信息,我将编辑此答案。
如果您已按照上面链接的“问题排查指南”进行操作,则您的用户应接收聊天通知如果没有,您可以尝试更新MS Teams桌面或移动客户端。 @
提及用户和/或频道也许会有所帮助
通常,需要从下面添加trustServiceUrl
代码的关键问题。通常,忽略这样做会表现为500错误,但对于团队而言,似乎不会创建通知。您基本上需要设置turncontext.activity的几个属性并信任serviceUrl。
实例化一些关键变量:
const teamsChannel = '19:[email protected]';
const serviceUrl = 'https://smba.trafficmanager.net/amer/';
发送活动
// This ensures that your bot can send to Teams - serviceUrl ensures notifications, too
turnContext.activity.conversation.id = teamsChannel;
turnContext.activity.serviceUrl = serviceUrl;
MicrosoftAppCredentials.trustServiceUrl(serviceUrl);
await turnContext.sendActivity(yourActivity);
你也可以create Activity Feed Notifications。它的要点是你需要:
text
和summary
channelData
设置为true的notifications.alert
这段代码将实现:
const msg = MessageFactory.text('my message');
msg.summary = 'my summary';
msg.channelData = {
notification: {
alert: true,
},
};
return await dc.context.sendActivity(msg);
结果:
注意:要接收通知,您和您的用户必须遵循该频道。