question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Buttons click handling MS Botframework

See original GitHub issue

Rasa 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:open
  • Created 3 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
thaumecommented, Dec 9, 2022

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!

0reactions
sync-by-unito[bot]commented, Dec 19, 2022

➤ 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use button for input - Bot Service | Microsoft Learn
Learn how to send suggested actions within messages using the Bot Framework SDK for JavaScript.
Read more >
c# - How do you handle CardAction Button Clicks in Bot ...
If you want to differentiate the button click then you can go with "Adaptive Card" in ms teams. Because while clicking on the...
Read more >
[Question] Unable to tell it's a button click event or just text ...
My bot would send a series of cards with some buttons on each card. By clicking the button step by step, the user...
Read more >
Using Adaptive Cards with the Microsoft Bot Framework
Introduction. Adaptive Cards are a way to present a self-contained UI to a user within a larger UI such as a chat client....
Read more >
Bot Framework Composer - Build a Weather Bot - YouTube
Download Bot Framework Composer here: https://github.com/ Microsoft / BotFramework -ComposerA tutorial walkthrough that demonstrates using Bot ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found