gpt4 book ai didi

node.js - 错误 : Activity resulted into multiple skype activities bot FrameWork

转载 作者:行者123 更新时间:2023-12-04 09:27:40 26 4
gpt4 key购买 nike

我正在尝试使用主动消息向 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 团队 channel 发送主动消息与向个人对话发送主动消息没有什么不同,因此您应该使用 sendToConversation而不是 createConversation .要在任何地方发送主动消息,您需要确保拥有对话 ID。在 Teams 中,trust the service URL 也很重要.
如果要在团队 channel 中启动新线程,可以通过从对话 ID 中删除线程 ID 来实现。看这里:Microsoft Bot - Node SDK: How to post to a public channel *without replying to a prev. activity*
如果您想查看,似乎有一个关于在团队 channel 中启动新线程的示例:https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/javascript_nodejs/58.teams-start-new-thread-in-channel

关于node.js - 错误 : Activity resulted into multiple skype activities bot FrameWork,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62950153/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com