Search code examples
javascriptconversational-ui

Open dhee.ai web widget with a launcher intent?


I'm using dhee.ai widgets to take orders on my site. I've identified cases where I want to programattically launch the widget with certain user intents upfront. This should happen without user having to click on the bot icon.

How can I do that ?


Solution

  • It can be done using a javascript call as below

    var myIntent = 'yourIntentToBeServedOnStartup'
    var myParams = {param1:value1} //optional
    var phoneNum = '9999999999'
    
    DheeChatWidget.launchWithIntent("Guest", phoneNum, language, myIntent, myParams);
    

    An example HTML which uses a custom intent to launch, can be seen here https://github.com/DheeYantra/dhee-widget-examples/blob/main/src/main/resources/static/index.html