Reputation: 325
I have a chatbot based on Smooch.io and I am trying to show a menu on chat initialization so user can start from here instead of typing anything.
As far as I understand from the docs, to do that I need to create conversation Smooch.startConversation();
and then send stuff from my backend app. However it gives me "Smooch.startConversation();" error.
So my question is 1) What I am doing wrong here?; 2) Is there any other way to show initial menu instead of starting conversation without user yet messaging anything?
Upvotes: 1
Views: 420
Reputation: 185
Assuming you're using the latest version of the SDK, you're probably calling startConversation
before the SDK has finished initializing.
You should wait for the promise returned by init
to resolve before calling startConversation
. Like this:
Smooch.init({appId: '<app-id>'})
.then(() => {
Smooch.startConversation();
})
Upvotes: 1