botman / driver-botframework

BotMan Microsoft Bot Framework Driver
MIT License
9 stars 12 forks source link

'from' details missing when sending responses to Bot Framework #18

Open neilherbertuk opened 3 years ago

neilherbertuk commented 3 years ago

I've not gotten as far as trying this with Microsoft teams but I've setup a new copy of Botman Studio with the Bot Framework driver and am testing it with the Bot Framework Emulator.

So using the out of the box routes and such, I'm getting a 400 response from the callback being sent to the emulator when sending the message "Hi" from the emulator. I'm expecting botman to reply with "Hello!"

{ "error": { "code": "ServiceError", "message": "Cannot read property 'name' of undefined" } }

It looks like the payload being sent is missing fields.

Botman is sending the following payload as a response which results in the 400 from the emulator

{"payload":{"type":"message","text":"Hello!"}}

Manually adding a from the id and bot name to the payload within the buildServicePayload method allows the message to be received

        $additionalParameters = [
            'from' => [
                'name' => 'Bot',
                'id' => '*ID*FROM*REQUEST*',
            ],
        ];

Payload sent to callback url

{"payload":{"type":"message","from":{"name":"Bot","id":"IDFROMREQUEST"},"text":"Hello!"}}

I'm fairly new to BotMan so not familiar enough with the flow of everything to fix this yet.