Skip to content

Add userId param to widgetOpened event#39

Open
sasha-x wants to merge 1 commit intobotman:masterfrom
botman-fork:patch-1
Open

Add userId param to widgetOpened event#39
sasha-x wants to merge 1 commit intobotman:masterfrom
botman-fork:patch-1

Conversation

@sasha-x
Copy link

@sasha-x sasha-x commented Sep 2, 2019

If I am trying to start conversation with user from widgetOpened event, like this:

//index.html
var botmanWidget = {
sendWidgetOpenedEvent: 1
}
//bot.php
$botman->hears('(.*)', function ($bot){
    $bot->startConversation(new WelcomeConversation());
});

I see in my cache conversation duplicates (and in UI too):

root@scw:~# redis-cli KEYS '*'
1) "botman:cache:conversation-da39a3ee5e6b4b0d3255bfef95601890afd80709-da39a3ee5e6b4b0d3255bfef95601890afd80709"
2) "botman:cache:conversation-0409cb8558ad20d53c230f23e83cc64e15b6fa70-0409cb8558ad20d53c230f23e83cc64e15b6fa70"

The first hash is constantly equals sha1("") . The reason is widgetOpened event, which raise first instance of conversation, has no binding to any user.

With my fix all seems to work ok.

@sasha-x
Copy link
Author

sasha-x commented Sep 9, 2019

@mpociot , could you plz pay some attention to PRs?
There are several other points which may become issues or PRs in main botman repo.

@EranGrin
Copy link

Great, I'll add it to here https://www.npmjs.com/package/botman-extended-web-widget

EranGrin added a commit to EranGrin/botman-extended-web-widget that referenced this pull request Apr 30, 2024
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

Successfully merging this pull request may close these issues.

3 participants

Comments