Closed selphe closed 5 years ago
Thanks for raising this issue, @paulaWesselmann will get back to you about it soon.
Hey @selphe What is your input message to the bot?
Also what do you mean by this: From webchat (azure side), I see, what the message is out
?
Hello @paulaWesselmann My input message to the bot is text: 'hi', 'hello', 'sad' etc, anyhing that triggers 'utters' from default config.
Azure web chat is my input channel, when message from web chat can't reach endpoint (e.g. rasa offline) it show me error in dialog window, something like 'message can't be delivered' or 'bad gateway' etc.
In my case, here is no error message, this means, i think, rasa's botframework connector successfuly authenticates at azure botframework portal, but bot just doesn't reply anything. Error at rasa side looks like rasa can't handle received message 'type'. Maybe something changed in microsoft api?
Hello @paulaWesselmann, any news?
I did some research with core/channels/botframework.py
Here is my tests:
GET
to http://server_name/webhooks/botframework
Answer from rasa:
{
"status": "ok"
}
POST
to http://server_name/webhooks/botframework/webhook
Answer from rasa:
success
Request from MS botframework, which I receive at nginx (rasa behind the proxy), at first looks correct:
{
"text": "Hi",
"textFormat": "plain",
"type": "message",
"timestamp": "2019-04-01T08:23:13.979Z",
"localTimestamp": "2019-04-01T15:23:13.979+07:00",
"id": "1554106993898",
"channelId": "msteams",
"serviceUrl": "https://smba.trafficmanager.net/emea/",
"from": {
"id": "29:1YaNK8IFAhKpkRohwsg1SXlbAqQUbEizQ7Ly20X56T7zJ-znPQK4F_M7JYHM24LnRh91GjaiL3MFiocLtUHnpHw",
"name": "<full name>",
"aadObjectId": "3a18afcc-8433-488b-92aa-a0fa2110b436"
},
"conversation": {
"conversationType": "personal",
"id": "a:1DvsYGaPdrB0UcT_PT8c3fVASc5kcSqvxvt-488HZGTEdIj3xvs7VsEv8ZV0kAtDlqZIzVX2rYIWbLjguCHmalx0enkoju7hoWg_wQtYuO0zo4n1JIf0NOyetaJd7N6Wq"
},
"recipient": {
"id": "28:5d295fc8-9a6a-4b88-8697-2c87ff2be07c",
"name": "<channel name from Azure portal>"
},
"entities": [{
"locale": "en-US",
"country": "US",
"platform": "Web",
"type": "clientInfo"
}
],
"channelData": {
"tenant": {
"id": "e1e69249-edd0-431d-93b5-a25d7d98e5d2"
}
},
"locale": "en-US"
}
But rasa doesn't answer: https://imgur.com/428OJmG What could be wrong?
@selphe awesome this output is very helpful! The BotFramework() expects following inputs:
def __init__(self,
app_id: Text,
app_password: Text,
conversation: Dict[Text, Any],
bot_id: Text,
service_url: Text) -> None:
which are called like this:
BotFramework(self.app_id, self.app_password,
postdata["conversation"],
postdata["recipient"],
postdata["serviceUrl"])
I think the type error is because it expects Text
but gets a Dict
for the recipient
.
This is fixed by changing the call in 'botframework.py` to
postdata["recipient"]["id"]
I am not sure if this is something that has to be fixed in the core code for everyone. I'll investigate and get back to you. Let me know if you have further questions.
I'll make a PR for this.
@selphe can you try out if this change fixes your issue and report back here?
Hey @tupac56, Can you have a look at this issue?
I'm not sure if this is usage dependent, or if the recipient
always is a dictionary containing name and id. (I couldn't find other reports of people running into this error)
Do you know what is the case here, is this something that should be fixed in the code?
"recipient": {
"id": "28:5d295fc8-9a6a-4b88-8697-2c87ff2be07c",
"name": "<channel name from Azure portal>"
}
Hey @paulaWesselmann!
You're right, in the response returned by the bot, the recipient
should be a dict, I misnames the argument bot_id
.
https://github.com/RasaHQ/rasa_nlu/blob/719b2663652d949925de9a2dea1da83bbe3ea453/rasa/core/channels/botframework.py#L35
I guess this line should be replaced by something like this:
bot: Dict[Text, Any]
if you choose to give the integrality of postdata["recipient"]
as argument to BotFramework
.
The BotFramework API reference specify that the response from the bot payload should be formatted like this:
{
"...": "...",
"from": {
"id": "12345678",
"name": "bot's name"
}
}
where in our case
postdata["recipient"] = {
"id": "12345678",
"name": "bot's name"
}
Hope it works out!
Thank you @tupac56! That information about the botframework API is what I was looking for.
Hey @paulaWesselmann I can confirm, what @tupac56 suggestion almost works for me, but I'm not a developer, so please note at my steps:
I've setup clean env on local machine under Windows:
Changed botframework.py
From this:
bot_id: Text,
To this:
bot_id: Dict[Text, Any],
Now, I can communicate with the bot via botframework channels (tested MS Teams and Azure webchat). How to get it working with docker?