【问题标题】:Error: Activity resulted into multiple skype activities bot FrameWork错误:活动导致多个 Skype 活动 bot FrameWork
【发布时间】:2020-07-17 08:33:47
【问题描述】:

我正在尝试使用主动消息向频道发送附件, 下面是我的代码。

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

【问题讨论】:

  • 您是要向频道发送附件还是创建对话?
  • 你还在做这个吗?
  • @KyleDelaney 是的
  • 我正在尝试向频道发送附件
  • 你既没有投票也没有接受我的回答,你决定让你的赏金到期而不是奖励给我。我仍然愿意帮助你。你还需要帮助吗?

标签: node.js botframework


【解决方案1】:

向 Teams 团队频道发送主动消息与向个人对话发送主动消息没有什么不同,因此您应该使用 sendToConversation 而不是 createConversation。要在任何地方发送主动消息,您需要确保您拥有对话 ID。在 Teams 中,trust the service URL 也很重要。

如果您想在团队频道中启动新话题,可以通过从对话 ID 中删除话题 ID 来实现。见这里:Microsoft Bot - Node SDK: How to post to a public channel *without replying to a prev. activity*

如果您想查看的话,似乎有一个关于在团队频道中启动新线程的示例:https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/javascript_nodejs/58.teams-start-new-thread-in-channel

【讨论】:

  • 我会试试这个并让你知道,顺便说一句谢谢你的帮助:-)
  • 我刚试过这个,但我不认为这是我问题的答案,因为我试图使用频道 ID 发送消息,而不是对话 ID,因为我必须保存在那种情况下进行对话,我不想要,因为我已经知道频道 ID 是静态的,不会经常更改,所以请您在这个方向上帮助我
  • Teams 是您的频道。 Bot Framework 理解的“通道 ID”是 msteams。不幸的是,Teams 有自己的东西,称为团队和频道,因此这些术语是模棱两可的。我猜当您说“频道 ID”时,您的意思是 Teams 团队频道的 ID,而不是 Bot Framework 频道的 ID。在这种情况下,这与对话 ID 没有区别。团队频道中的所有线程共享一个可用于标识团队频道的根对话 ID。您能否解释一下为什么您认为对话 ID 不是静态的,并且与频道 ID 不同?
猜你喜欢
  • 2020-10-31
  • 2015-02-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-02-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多