Error: Activity resulted into multiple skype activities bot FrameWork
Error: Activity resulted into multiple skype activities 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-attachments
向 Teams 团队频道发送主动消息与向个人对话发送主动消息没有什么不同,因此您应该使用 sendToConversation
而不是 createConversation
。要在任何地方发送主动消息,您需要确保拥有对话 ID。在 Teams 中,trust the service URL.
也很重要
如果您想在团队频道中开始新话题,您可以通过从对话 ID 中删除话题 ID 来实现。看这里:
似乎有一个关于在团队频道中开始新话题的示例,如果您想查看的话:https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/javascript_nodejs/58.teams-start-new-thread-in-channel
我正在尝试使用主动消息发送附件到频道, 下面是我的代码。
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-attachments
向 Teams 团队频道发送主动消息与向个人对话发送主动消息没有什么不同,因此您应该使用 sendToConversation
而不是 createConversation
。要在任何地方发送主动消息,您需要确保拥有对话 ID。在 Teams 中,trust the service URL.
如果您想在团队频道中开始新话题,您可以通过从对话 ID 中删除话题 ID 来实现。看这里:
似乎有一个关于在团队频道中开始新话题的示例,如果您想查看的话:https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/javascript_nodejs/58.teams-start-new-thread-in-channel