node.js - 错误:活动导致多个 Skype 活动 bot FrameWork
问题描述
我正在尝试使用主动消息向频道发送附件,下面是我的代码。
async function sendToChannelWithImage(message,channelId,img) {
MicrosoftAppCredentials.trustServiceUrl('');
var credentials = new MicrosoftAppCredentials('app-id', 'password');
var client = new ConnectorClient(credentials, { baseUri: 'https://smba.trafficmanager.net/us/' });
var conversationResponse = await client.conversations.createConversation({
bot: {
id: 'app-id',
name: 'test'
},
isGroup: true,
conversationType: "channel",
channelData: {
channel: { id: channelId }
},
activity: {
type: 'message',
text: message,
attachments: [img]
}
});
}
const img = {contentType: 'image/*',contentUrl: "https://theysaidso.com/img/qod/qod-inspire.jpg"};
message = 'test'
channelId = 'testid'
在此我尝试使用机器人框架发送消息,我尝试过:https ://docs.microsoft.com/en-us/azure/bot-service/nodejs/bot-builder-nodejs-send-receive -附件
解决方案
将主动消息发送到 Teams 团队频道与将主动消息发送到个人对话没有什么不同,因此您应该sendToConversation
使用createConversation
. 要在任何地方发送主动消息,您需要确保您拥有对话 ID。在 Teams 中,信任服务 URL也很重要。
如果您想在团队频道中启动新线程,可以通过从对话 ID 中删除线程 ID 来实现。请参阅此处:Microsoft Bot - Node SDK:如何在不回复上一个的情况下发布到公共频道*。活动*
如果您想检查一下,似乎有一个关于在团队频道中启动新线程的示例:https ://github.com/microsoft/BotBuilder-Samples/tree/master/samples/javascript_nodejs/58.teams-start -new-thread-in-channel
推荐阅读
- python - 为什么创建虚拟环境后会存在 3 个 pip 模块?
- intellij-idea - IdeaVim - 如何在正常模式下使用竖线?
- objective-c - 计算目标 C 的预计到达时间和到达距离
- mysql - 如何使用 MySQL 将数据从一个服务器数据库插入到另一个服务器数据库?
- c# - 从 Project Online 获取 ProjectSiteUrl 不起作用
- angularjs - 在 ng-repeat 中附加结果,可能吗?
- java - 设置 Java 跟踪日志记录的最大文件大小
- python-3.x - 谁能告诉我哪个 dask.dataframe 在内存效率方面比 pandas 更胜一筹?
- ios - 如何从系统警报中获取本地化标题
- javascript - SAPUI5 在正确的时间分配模型