microsoft / microsoft/BotFramework-WebChat

Suggested Actions vanish after sending an event

Open
#2,124 7 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backlog Bot Services customer-replied-to customer-reported feature-request front-burner p1
Dominant language
HTML
Stars
1.8k
Forks
1.6k
Avg merge
22h 58m
Merged PRs (30d)
2

Description

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 - https://github.com/microsoft/BotFramework-WebChat/issues/2116#issuecomment-505177342. 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]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue by loading an existing conversation with suggested actions, then dispatching the documented WEB_CHAT/SEND_EVENT action through the Redux store. Trace how the event affects the displayed conversation history and suggested actions; done means the previous suggested actions remain visible after the event is sent.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.