Search code examples
jsonrestbotframeworkmicrosoft-teamsazure-bot-service

Bot Framework REST API send proactive message to multiple users with one conversation ID


I'm wondering if there is a way to send 1:1 message to users using only one conversation id? So instead of looping through each user and generating a conversation id, I'm trying to create a request to generate a conversation ID with multiple members.

See payload below:

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"
}

I'm getting a BadSyntax HTTP 400 error:

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

Is this possible?


Solution

  • Things like proactive messaging, creating a conversation, and conversation ID's are all channel-specific so it's important to be explicit about what channel you're using in these situations. From your JSON it looks like you're using Microsoft Teams. Every conversation in Microsoft Teams will have a unique conversation ID, and every 1:1 chat between a bot and a user needs to be its own conversation, so there is no way to use only one conversation ID for multiple chats with users.