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

Suggested Actions vanish after sending an event #2124

Open
artemvalmus opened this issue Jun 26, 2019 · 7 comments
Open

Suggested Actions vanish after sending an event #2124

artemvalmus opened this issue Jun 26, 2019 · 7 comments
Labels
backlog Out of scope for the current iteration but it will be evaluated in a future release. Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-replied-to Required for internal reporting. Do not delete. customer-reported Required for internal Azure reporting. Do not delete. feature-request Azure report label front-burner p1 Painful if we don't fix, won't block releasing

Comments

@artemvalmus
Copy link

artemvalmus commented Jun 26, 2019

Version

"botframework-webchat": "^4.3.0"

Describe the bug

After sending an event to the bot the suggested actions from the previous conversation, loaded from DirectLine using the conversation ID and WebChat token, disappear. So all the chat history is loaded, including the last suggested actions. But when I send a WEB_CHAT/SEND_EVENT activity to the bot the buttons vanish. This behavior is clear with sending a user message, but is there a point in hiding them after the event which may not be connected with the user actions?

The event is sent as follows:

const store = createStore(
{},
({ dispatch }: any) => (next: any) => (action: any) => {
    if (action.type === 'DIRECT_LINE/CONNECT_FULFILLED') {
        setTimeout(() => {
            const jobId = getJobIdFromRoute();
            dispatch({
                payload: {
                    name: 'webchat/jobcontext',
                    value: {
                        gdprAccepted,
                        jobId: jobId ? jobId : 0
                    }
                },
                type: 'WEB_CHAT/SEND_EVENT'
            });
        }, 1000);
    } else if (action.type === 'DIRECT_LINE/INCOMING_ACTIVITY') {
        if (action.payload.activity.from.role === 'bot') {
            this.setState(() => ({ newMessage: true }));
        }
    }
    return next(action);
});

To Reproduce

Steps to reproduce the behavior:

  1. Retrieve an existing conversation using the ID and the WebChat token as described here - Passing existing conversation ID and Secret to DirectLine API results in a new conversation #2116 (comment). Make sure the conversation has suggested actions in the last activity
  2. Initialize the bot so the conversation history is displayed including the suggested actions
  3. Send a WEB_CHAT/SEND_EVENT event to the bot using the Redux store dispatch method as in the code above
  4. See error - the suggested actions disappear

Expected behavior

Suggested actions from the previous conversation, loaded from DirectLine using the conversation ID and WebChat token, are displayed after sending a WEB_CHAT/SEND_EVENT activity to the bot.

[Bug]

@artemvalmus artemvalmus added bug Indicates an unexpected problem or an unintended behavior. Pending labels Jun 26, 2019
@corinagum corinagum added question Further information is requested. Stack Overflow candidate and removed bug Indicates an unexpected problem or an unintended behavior. Pending labels Jun 26, 2019
@corinagum
Copy link
Contributor

Taking a look at the Bot Framework schema, there's nothing to indicate whether the client should or should not make a suggested action disappear if the BOT sends another message after suggested actions is displayed.

However, suggested actions are sent with and tied to an activity, and I don't believe it would make sense or be easy to implement continual showing of the suggested actions when a new activity has come in via the send box. If anything, this would mean removing the suggested actions component and instead of displaying it in the send box, associating it with the activity that it came in with. In such case I believe a regular adaptive or Hero card is sufficient, and changes in this manner would defeat the original intent of suggested actions.

According to this sample

Unlike buttons that appear within rich cards (which remain visible and accessible to the user even after being tapped), buttons that appear within the suggested actions pane will disappear after the user makes a selection. This prevents the user from tapping stale buttons within a conversation and simplifies bot development (since you will not need to account for that scenario)."

To me, associating the suggested action with the activity it comes with (and thereby moving it up the transcript as more messages come in) defeats the purpose of preventing stale action items that the user might click when they are no longer relevant.

TLDR: I think that another activity coming in, whether from the bot or the user, renders the suggested action 'stale'.

@EricDahlvang, @cwhitten, @compulim, do you have other thoughts?

@compulim
Copy link
Contributor

compulim commented Jun 26, 2019

I think @artemvalmus has the point. Event is designed for non-visual and/or non-interactive activities, e.g. telemetry, idle check, etc. And this is not an intention from user, thus, it should not dismiss suggested actions. I believe this is same for the bot too.

Looking at packages/core/src/sagas/clearSuggestedActionsOnPostActivitySaga.js, this is one of the code that will modify suggested actions (the other one is sagas/incomingActivitySaga.js).

The code will clear suggested actions only if the user is posting an activity of type message. It won't clear suggested actions if the user is posting an event activity.

On the other side, in sagas/incomingActivitySaga.js, if the bot is sending any type of activities, we will clear the suggested actions.

@artemvalmus can you check if the suggested actions is caused by the bot, instead of the user?

I think it's fair to update our code to not clearing suggested actions if the last message from the bot is not of type message, because this is not visible to the user.

@hhasenauer
Copy link

@compulim Thank you for taking care of this. Can you maybe tell us when we can expect this change?

@corinagum corinagum added Enhancement backlog Out of scope for the current iteration but it will be evaluated in a future release. front-burner and removed question Further information is requested. Stack Overflow candidate Triage-E labels Jun 27, 2019
@corinagum
Copy link
Contributor

@hhasenauer currently there's no date associated with this work item. It's in our Backlog. Customers who are looking for this change should add their +1 here. :)

@corinagum corinagum self-assigned this Jul 8, 2019
@corinagum corinagum added the p1 Painful if we don't fix, won't block releasing label Jul 8, 2019
@Kaiqb Kaiqb added the Customer label Jul 23, 2019
@sgellock sgellock added customer-replied-to Required for internal reporting. Do not delete. customer-reported Required for internal Azure reporting. Do not delete. Bot Services Required for internal Azure reporting. Do not delete. Do not change color. and removed Customer labels Aug 8, 2019
@nmishr
Copy link

nmishr commented Aug 18, 2020

Also have the same issue.

@cwhitten cwhitten added the R11 label Aug 18, 2020
@corinagum corinagum added feature-request Azure report label and removed Enhancement labels Sep 23, 2020
@corinagum corinagum removed R11 backlog Out of scope for the current iteration but it will be evaluated in a future release. front-burner labels Sep 23, 2020
@corinagum corinagum added this to the R11 milestone Sep 23, 2020
@corinagum corinagum added backlog Out of scope for the current iteration but it will be evaluated in a future release. front-burner labels Oct 5, 2020
@corinagum corinagum modified the milestones: R11, Backlog Oct 5, 2020
@cwhitten cwhitten modified the milestones: Backlog, R13 Feb 26, 2021
@cwhitten
Copy link
Member

Loading this up for discussion/prioritization in our upcoming milestone

@corinagum
Copy link
Contributor

Didn't make the R13 list but we'll keep this on front-burner.

@corinagum corinagum removed this from the R13 milestone Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Out of scope for the current iteration but it will be evaluated in a future release. Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-replied-to Required for internal reporting. Do not delete. customer-reported Required for internal Azure reporting. Do not delete. feature-request Azure report label front-burner p1 Painful if we don't fix, won't block releasing
Projects
None yet
Development

No branches or pull requests

8 participants