本文介绍了Bot Framework API创建具有多个成员的会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试与多个成员创建对话并生成对话ID.我的目标是使bot消息一个一一列出在成员"键中列出的每个成员.当我只在"members"键中放入一个项目,并且能够生成对话ID时,它的工作原理与应该的完全一样.但是,当我在"members"键中放置2个或更多项时,即使它应该是一组成员数组,也会出现错误.

I'm trying to create a conversation with multiple members and generating a conversation id. My goal is to have the bot message each member listed in the "members" key one-by-one. It works exactly as it should when I only put one item in the "members" key and I am able to generate a conversation id. However, I'm getting an error when I put 2 or more items in the "members" key even though it's supposed to be an array of members.

POST /v3/conversations

{
  "activity": {
    "type": "message",
    "channelId": "msteams",
    "text": "Testing"
  },
  "bot": {
    "id": "215000000-00000-0000-00000",
    "name": "Test",
    "aadObjectId": null,
    "role": null
  },
  "isGroup": false,
  "members": [
    {
      "id": "29:asda123123asdad123sdadassaw1233fwmHog5cU9_rRLIauRiA6Mzsdadassaw1233fwm1H",
      "name": null,
      "aadObjectId": null,
      "role": null
    },
    {
      "id": "29:asdadassaw1233fwmHog5cU9_rRLIauRiA6MzE4TJ98ldUVqOm32asd12qCZs5eu_pjL8mUg",
      "name": null,
      "aadObjectId": null,
      "role": null
    }
  ],
  "tenantId": "12312312adasdadtest"
}

这会产生HTTP 400错误请求错误

This yields a HTTP 400 Bad Request Error

{
    "error": {
        "code": "BadSyntax",
        "message": "Incorrect conversation creation parameters"
    }
}

有人可以帮我吗?非常感谢.

Could anyone please help me with this? Thank you so much.

推荐答案

members是数组的原因是因为它可用于群组对话.您已将isGroup设置为false,因此您没有在创建群组对话.如果您要创建多个对话,则需要发送多个请求,您认为这些请求是有效的.

The reason members is an array is because it can be used for group conversations. You have set isGroup to false so you are not creating a group conversation. If you want to create multiple conversations then you will need to send multiple requests, which you've said is working.

这篇关于Bot Framework API创建具有多个成员的会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 07:19