Skip to content
This repository has been archived by the owner on May 10, 2020. It is now read-only.

How to effectively reset conversation. #7

Open
MartinBodocky opened this issue May 30, 2017 · 1 comment
Open

How to effectively reset conversation. #7

MartinBodocky opened this issue May 30, 2017 · 1 comment

Comments

@MartinBodocky
Copy link

I have solution where I have four different use cases. I would like to keep header just change text.

This is inside one content div frame. I have tried to apply reset like following:
element.fbMessenger({
botName: '...
})
.fbMessenger('reset');

or after start:

element
.fbMessenger('start', { delay: 3000 })
.fbMessenger('reset')

or before run:
element
.fbMessenger('reset')
.fbMessenger('run', { timestamp: this.now, delay: 2000 });

All of those ends with error:
Error: Must call start before sending messages
at Function.error (eval at module.exports (http://localhost:4205/scripts.bundle.js:1:1), :253:9) [angular]
at b._checkWelcomeMessage (eval at module.exports (http://localhost:4205/scripts.bundle.js:1:1), :11:11579) [angular]
at b.message (eval at module.exports (http://localhost:4205/scripts.bundle.js:1:1), :11:16119) [angular]
at eval (eval at module.exports (http://localhost:4205/scripts.bundle.js:1:1), :11:27172) [angular]
at Object.onInvokeTask (http://localhost:4205/vendor.bundle.js:28650:37) [angular]
at ZoneDelegate.invokeTask (http://localhost:4205/vendor.bundle.js:85621:40) [angular]
at Zone.runTask (http://localhost:4205/vendor.bundle.js:85498:47) [ => angular]
at ZoneTask.invoke (http://localhost:4205/vendor.bundle.js:85692:33) []
at data.args.(anonymous function) (http://localhost:4205/vendor.bundle.js:86723:25) []

What am I doing wrong?

Thanks,

Martin

@wycoconut
Copy link

Hi Martin,

Just came across this problem as well, I used this approach to workaround it.

var runningDemo = $('.phone')
	.fbMessenger({
		botName: 'My Bot',
		botWelcomeMessage: 'This is a simulated Facebook Messenger bot for demonstration purposes only.',
		loop: false,
	});

runningDemo.fbMessenger('init');

runningDemo.fbMessenger('start', { delay: 5 * 1000 });

runningDemo.fbMessenger('message', 'bot', 'Hope this helps', { delay: 1500 });

runningDemo.fbMessenger('run');

The line runningDemo.fbMessenger('init'); does the magic of resetting the conversation.

Hope it helps :)

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

No branches or pull requests

2 participants