Buttons click handling MS Botframework
See original GitHub issueRasa version: 2.3.0
Rasa SDK version (if used & relevant): Nope
Rasa X version (if used & relevant): Nope
Python version: I’m using the provided dockerfile to build and run Rasa
Operating system (windows, osx, …): MacOS, but again rasa is running in Docker
Issue:
I’m having an issue with handling buttons clicks coming from Teams. The way Teams handles clicks and text input is different and right now the Botframework Rasa connector (that was built by my company 2 years ago) doesn’t support that.
We have a working version that we keep up to date with the master repo from time to time but I think it would make more sense to take the time to merge it.
And… it’s just 6 lines of code <g-emoji class="g-emoji" alias="sweat_smile" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f605.png"> 😅 </g-emoji>
Error (including full traceback): This is the stacktrace shown by Rasa after a click on a button
2021-03-10 09:47:44 DEBUG rasa.core.processor - Received user message ‘’ with intent ’
{‘name’: None, ‘confidence’: 0.0}
’ and entities ‘[]’
Command or request that led to error: After writing and sending a message (“Home”) to Rasa from Teams, this JSON is sent to rasa endpoint :
{ "text": "Home", "textFormat": "plain", "type": "message", "timestamp": " ", "localTimestamp": " ", "id": " ", "channelId": "msteams", "serviceUrl": "https://smba.trafficmanager.net/emea/", "from": { "id": " ", "name": " ", "aadObjectId": " " } , "conversation": { "conversationType": "personal", "tenantId": " ", "id": " " } , "recipient": { "id": " ", "name": " " } , "entities": [ { "locale": "en-GB", "country": "GB", "platform": "Web", "timezone": "Europe/Paris", "type": "clientInfo" } ], "channelData": { "tenant": { "id": " " } }, "locale": "en-GB", "localTimezone": "Europe/Paris" }
After clicking on a button from a card (created by the chatbot) on Teams, this JSON is sent to rasa endpoint :
{ "type": "message", "timestamp": " ", "localTimestamp": " ", "id": " ", "channelId": "msteams", "serviceUrl": "https://smba.trafficmanager.net/emea/", "from": { "id": " ", "name": " ", "aadObjectId": " " } , "conversation": { "conversationType": "personal", "tenantId": " ", "id": " " } , "recipient": { "id": " ", "name": " " } , "entities": [ { "locale": "en-GB", "country": "GB", "platform": "Web", "timezone": "Europe/Paris", "type": "clientInfo" } ], "channelData": { "tenant": { "id": " " } , "source": { "name": "message" } , "legacy": { "replyToId": " " } }, "replyToId": " ", "value": { "id": "Jobs" } , "locale": "en-GB", "localTimezone": "Europe/Paris" }
As you can see, the text
key is present only when sending data as text but not when clicking on a button (the button’s data is inside a value
dict).
Right now this data is handled here : https://github.com/RasaHQ/rasa/blob/main/rasa/core/channels/botframework.py#L236
And we are handling it like that on our repo :
text = "" if postdata.get("text"): text = postdata.get("text") else: if postdata.get("value"): raw_value = postdata.get("value") if "value" in raw_value: raw_value = raw_value<span class="error">["value"]</span> text = json.dumps(raw_value) user_msg = UserMessage( text=text, output_channel=out_channel, sender_id=postdata<span class="error">["from"]</span><span class="error">["id"]</span>, input_channel=self.name(), metadata=metadata_with_attachments, )
How would you like to solve this problem ?
Thanks !
Content of configuration file (config.yml) (if relevant): not modified
Content of domain file (domain.yml) (if relevant): not modified
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (3 by maintainers)
Hey everyone,
Just FYI @guilhermemoraisr, only tests are missing. It’s very possible the code doesn’t work with the latest version of MS Botframework tho
The project I was working on for bot framework was finished about a year ago so I don’t use it anymore but happy to help if you have questions!
➤ Maxime Verger commented:
💡 Heads up! We’re moving issues to Jira: https://rasa-open-source.atlassian.net/browse/OSS.
From now on, this Jira board is the place where you can browse (without an account) and create issues (you’ll need a free Jira account for that). This GitHub issue has already been migrated to Jira and will be closed on January 9th, 2023. Do not forget to subscribe to the corresponding Jira issue!
➡️ More information in the forum: https://forum.rasa.com/t/migration-of-rasa-oss-issues-to-jira/56569.