Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick Reply not working #100

Closed
Kaijiro opened this issue Jul 23, 2018 · 9 comments
Closed

Quick Reply not working #100

Kaijiro opened this issue Jul 23, 2018 · 9 comments
Assignees

Comments

@Kaijiro
Copy link

Kaijiro commented Jul 23, 2018

Hey,

I'm using botbuilder version 4.0.0a6 and I have a struggle with quick replies.
Quick replies are displayed in the emulator but not in any other Skype Client.

Here is the code I used :

def handle_request(self, request, channel_model):
    data = request.data

    activity = Activity.deserialize(data)

    if not self.__handle_authentication__(request, channel_model):
        return

    if activity.type == ActivityTypes.message.value:
        resp_activity = Activity(
            type=ActivityTypes.message,
            channel_id=activity.channel_id,
            conversation=activity.conversation,
            from_property=activity.recipient,
            recipient=activity.from_property,
            service_url=activity.service_url
        )

        replies = [
            {
                "title": "Test1",
                "type": ActionTypes.im_back,
                "value": "Test1",
            },
            {
                "title": "Test2",
                "type": ActionTypes.im_back,
                "value": "Test2",
            }
        ]

        resp_activity.text = "My text"
        resp_activity.suggested_actions = SuggestedActions(actions=replies, to=[activity.from_property.id])

        credentials = MicrosoftAppCredentials(channel_model.settings["app_id"], channel_model.settings["app_password"])

        try:
            connector = ConnectorClient(credentials, response_activity.service_url)
            connector.conversations.send_to_conversation(resp_activity.conversation.id, response_activity)
        except Exception as e:
            print("An error happened ! ")
            traceback.print_tb(e.__traceback__)
    else:
        return

Any help is really appreciated

@stevengum
Copy link
Member

stevengum commented Jul 24, 2018

Hey @Kajiro,
This is due to a channel limitation on Skype's end. They unfortunately do not support SuggestedActions aka "Quick Replies" if they are not part of a Card.

(See Channel Skype: | Feature: Suggested actions, then Notes -> Availability)

I spun up a v3 Node.js bot to test as well, and Skype did not send the activity's text in addition to the suggestedActions; but the prompt and suggestedActions were sent over WebChat.

@stevengum stevengum reopened this Jul 24, 2018
@stevengum
Copy link
Member

I checked my bot again and saw that it was possible using version 12.1815.210.0 on Windows 10 Enterprise, so I'm looking back into this, sorry @Kaijiro!

@Kaijiro
Copy link
Author

Kaijiro commented Jul 24, 2018

No problem, thank you for the investigation. If you need me to test anything, feel free to ask !

@stevengum
Copy link
Member

@Kaijiro, the issue was actually that the suggestedAction was being sent to the bot instead of to the user. The correct code is this:

activity.suggested_actions = SuggestedActions(actions=replies, to=[activity.recipient.id])

as opposed to this:

activity.suggested_actions = SuggestedActions(actions=replies, to=[activity.from_property.id])

For some reason the Emulator was rendering the SuggestedActions to you, when in reality you shouldn't have been seeing them at all.

I opened a bug on microsoft/BotFramework-WebChat#1057 to fix this bug in webchat (which is used in the Emulator).

Let me know if this solves the problem for you

@Kaijiro
Copy link
Author

Kaijiro commented Jul 25, 2018

Are you sure about this ? Here, my activity variable is the result of the request deserialization, so the from attribute of activity is my final user and the recipient is the bot itself.

Please, correct me if I'm wrong.

@Kaijiro
Copy link
Author

Kaijiro commented Aug 2, 2018

@stevengum Hey, any news about this issue ? I just checked the code snippet I posted and saw that I named two variables activity ... Everything should be clearer now

@stevengum
Copy link
Member

@Kaijiro sorry I missed your earlier comment; the code you've changed it to above should be correct; developers should be using the incoming deserialized activity to generate the SuggestedActions.to property on the response activity by using activity.from_property

@Kaijiro
Copy link
Author

Kaijiro commented Aug 4, 2018

Hey !
I changed the code because I had a copy/paste error. This is the code actually used to send SuggestedActions but I can only see it in the Emulator, every other client does not render it.

@stevengum
Copy link
Member

It sounds like you've been squared away for some time, so I'm going to close this out for now. If you're still facing this problem, please create a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants