microsoft / BotFramework-Emulator

A desktop application that allows users to locally test and debug chat bots built with the Bot Framework SDK.
https://aka.ms/botemulator
MIT License
1.82k stars 755 forks source link

Emulator v4 not sending valid ConversationAccount object #2397

Closed drmason13 closed 2 years ago

drmason13 commented 2 years ago

Version

4.14.1

Describe the bug

According to the botframework protocol, ConversationAccount requires the following fields:

"conversationType", "id", "isGroup", "name"

but in a message activity received from the emulator (the emulated user channel) only the id field was provided:

...
    "conversation": {
        "id": "40f7b490-2609-11ed-a12d-37cd6a1cd89f|livechat"
    },
...

I think that either the emulator isn't implementing the protocol fully, or the json schema representing the protocol I have been referring to is wrong/out of date.

I'd appreciate being pointed to an up to date protocol json schema if there is one!

My reference is taken from github and hasn't been updated since 2020 which does make me worry it isn't being up up to date: https://github.com/microsoft/botframework-sdk/blob/main/schemas/protocol/botframework.json

To Reproduce

Steps to reproduce the behavior:

  1. Connect the bot emulator to an echo bot sample
  2. Send message "boo"
  3. receive full JSON including a "conversation" field with an incomplete ConversationAccount object as shown above. A full JSON response I received from version 4.14.1 emulator is provided in Additional Context.
  4. Note that the conversation object is missing required fields.

Expected behavior

The emulator should send requests that conform to the botframework protocol.

Additional context

Full JSON response I received from version 4.14.1 emulator:

{
    "channelData": {
        "clientActivityID": "1661605674602yeb2m7mrg1",
        "clientTimestamp": "2022-08-27T13:07:54.602Z"
    },
    "text": "boo",
    "textFormat": "plain",
    "type": "message",
    "channelId": "emulator",
    "from": {
        "id": "416478fc-8553-4ae2-b6ed-7a898d194cc4",
        "name": "User",
        "role": "user"
    },
    "locale": "en-US",
    "localTimestamp": "2022-08-27T14:07:54+01:00",
    "localTimezone": "Europe/London",
    "timestamp": "2022-08-27T13:07:54.623Z",
    "entities": [
        {
            "requiresBotState": true,
            "supportsListening": true,
            "supportsTts": true,
            "type": "ClientCapabilities"
        }
    ],
    "conversation": {
        "id": "40f7b490-2609-11ed-a12d-37cd6a1cd89f|livechat"
    },
    "id": "436e80f0-2609-11ed-a12d-37cd6a1cd89f",
    "recipient": {
        "id": "40f73f60-2609-11ed-aac7-933dc7e1b54d",
        "name": "Bot",
        "role": "bot"
    },
    "serviceUrl": "https://0c6c-90-242-173-221.ngrok.io"
}

[bug]

tracyboehrer commented 2 years ago

@johnataylor Update on this John?

drmason13 commented 2 years ago

I've just spotted some comments in a markdown specification of Activity for the Activity.conversation field:

The conversation field describes the conversation in which the activity exists. The value of the conversation field is a complex object of the Conversation account type. A2080: Channels, bots, and clients MUST include the conversation and conversation.id fields when generating an activity. The conversation.name field is optional and represents the display name for the conversation if it exists and is available. A2081: Channels SHOULD include the conversation.name and conversation.isGroup fields if they are available. A2082: Bots and clients SHOULD NOT include the conversation.name field unless it is semantically valuable within the channel. A2083: Bots and clients SHOULD NOT include the conversation.isGroup and conversation.converationType fields in activities they generate. A2084: Channels SHOULD include the conversation.conversationType field if more than one value is defined for the channel. Channels SHOULD NOT include the field if there is only one possible value.

So it looks like the emulator is behaving according to this written interpretation of the protocol, and I think that means the JSON schema is wrong - it doesn't match this written specification. That's 2 against 1: emulator and written spec vs an old json schema! 😄

The conversation.name field is optional This isn't true in the JSON schema! see: https://github.com/microsoft/botframework-sdk/blob/main/schemas/protocol/botframework.json#L192

I'll close this issue and raise another over at https://github.com/microsoft/botframework-sdk.