Skip to content

Greeting Message Web Chat v4 - Sending events from bot #1397

@DanielTizon

Description

@DanielTizon

Hi,
I am migrating from Webchat v3 to Webchat v4, and I am having problems when I post an event activity for welcome trigger. I was using the workable solution given in official botframework blog:

https://blog.botframework.com/2018/07/12/how-to-properly-send-a-greeting-message-and-common-issues-from-customers/

        botConnection
            .postActivity({
                from: user,
                name: 'requestWelcomeDialog',
                type: 'event',
                value: ''
            })
            .subscribe(function (id) {
                console.log('"trigger requestWelcomeDialog" sent');
            });

But when I try to do it in Webchat v4 React version, using the next code:

let directLine = window.WebChat.createDirectLine({ secret: '' });

directLine.postActivity({
                from: user,
                name: 'requestWelcomeDialog',
                type: 'event',
                value: ''
            })
            .subscribe(function (id) {
                console.log('"trigger requestWelcomeDialog" sent');
            });

the event arrives to the bot correctly, but I get a "conversation ended" error in the web browser console, and the messages don't arrive to the client.

Anybody can gimme an example about how to do it correctly in v4?

Thanks in advance!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions