Question buttons do not work in Bot Framework Emulator
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
Research direction
Start with BotFrameworkDriver.php around lines 55 and 118, then inspect the related case in BotFrameworkDriverTest.php around line 537. Run the driver tests and reproduce a question-button response in the Bot Framework Emulator. Done means the button response is parsed without a 500 error and the test covers the format emitted by question buttons.
Written by the indexing model from the issue text.
Description
Setup
I'm using the Botframework Emulator with Botman Studio and the bot framework driver.
Issue
- Start a new conversation that responds with a question.
- Click on button to respond.
- Response isn't parsed with a 500 error.
There appears to be an issue where the HTML tag that is being given to the question buttons as a response is in a different format to what is expected by the driver as a response.
Conversation
You said:
Start conversation
Huh - you woke me up. What do you need?
Tell a joke
Give me a fancy quote
You said:
Tell a joke <botman value="joke" />
Requests
[14:23:16] -> message Start conversation
[14:23:16] POST 200 directline/conversations//activities
[14:23:18]<- message application/vnd.microsoft.card.hero
[14:23:18] POST 200 conversations//activities
[14:23:20]-> message Tell a joke <botman value="joke" />
[14:23:21] POST 500 directline/conversations//activities
Error
ErrorException: Undefined offset: 1 in file /Users/hfh83/Documents/Projects/StatusBot/vendor/botman/driver-botframework/src/BotFrameworkDriver.php on line 60
This is because this regex doesn't match the pattern
BotFrameworkDriver.php55 preg_match('/<botman value="(.*)"><\/botman>/', $message->getText(), $matches);
The issue is that when the question buttons are generated as part of the convertQuestion method on line 118 of BotFrameworkDriver.php sets the HTML tag used for this to the shorthand ending in /> instead of a separate closing tag that's expected as shown above.
BotFrameworkDriver.php118 'value' => $button['text'].'<botman value="'.$button['value'].'" />',
The test used to check this has the closing tag as part of the test so the test passes, despite this being incorrect
BotFrameworkDriverTest.php537 $text = 'I use botman with Skype<botman value="yes"></botman>'
Solution
Change
BotFrameworkDriver.php55 preg_match('/<botman value="(.*)"><\/botman>/', $message->getText(), $matches);to
BotFrameworkDriver.php55 preg_match('/<botman value="(.*)" \/>/', $message->getText(), $matches);
I'll submit a pull request with the changes needed to fix this.
- Dominant language
- PHP
- Stars
- 9
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from botman/driver-botframework
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 1/5 Under an hour Newbie friendliness 50/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
All issues in botman/driver-botframework
Similar issues
-
Solved site promotion gate fails on runner PHP patch drift (expects 8.2.33, runner installs 8.2.34) Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Automattic/blocks-engine#2161 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Automattic/static-site-importer#1824 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
0. Needs triage 35-feedback bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100