Digital Assistant and Mobile

Get Involved. Join the Conversation.

Topic

    Don Querrer
    Welcome (Default) Message upon opening the Bot
    Topic posted October 2, 2018 by Don QuerrerGreen Ribbon: 100+ Points 
    171 Views, 11 Comments
    Title:
    Welcome (Default) Message upon opening the Bot
    Summary:
    Welcome (Default) Message upon opening the Bot
    Content:

    We wanted the bot to display a welcome greeting even before the user types anything (like a default message from chatbot). We created a WELCOME intent which will respond the welcome greeting. 

    Can we trigger that intent at the very start without typing any utterance? Or what would be the correct approach?

    Thanks!

    Image:

    Comment

     

    • Grant Ronald

      Generally speaking bots cannot initiate conversations - however if you are using the web channel there is a possibility that when the chat widget is launched you can "fake" this - are you using the web channel?

    • Don Querrer

      Yes, we are using web channel. But we are having challenges on "faking" this default message with the delivered UI of Oracle.

      If you could provide us how we can implement this then would appreciate that.

       

    • Rohit Dhamija

      Please try this:

      1.  sendMessage(message) function in Web SDK is used to send  a message on the user's behalf.  During initialization of bots ( in loadChat function ), I used this function and sent “Hello” . 
      2.       in my greetings Intent  add  “Hello” as an example, so this intent got resolved.
      3.       So as soon as the Web chat window opens, user is greeted with “hello” message and corresponding greetings intent is resolved and displayed on the screen.
      Regards,

      Rohit

      • Don Querrer

        Thanks Rohit, we implemented this, but we wanted that our "hello" message will not be visible and it is as if the bot was the first one who initiated the conversation and not the user.

        Thanks!

      • subhajit saha

        can we initiated the conversation without showing  "hello"?

         

        • Vikhil Khobragade

          HI,

          Yes you can try this code in app.js in javascript bot sdk.

          Bots.setDelegate({
          beforeDisplay(messageBody)
          {
          if (messageBody.metadata && messageBody.metadata.isHidden) {
          return null;
          }
          return messageBody;
          }
          });

           

          Regards,

          Vikhil 

          • subhajit saha

            Thank You Vikhil ...its working.....

            regards,

            Subhajit saha

             

            • Sharath Chandra Gavini

              Hi Subhajit,
              Can you post a full example code of how this is implemented?
              Thanks.

              • subhajit saha

                Hello Sharath,

                Try with this code...

                        .then(function (res){
                           Bots.updateUser(
                                {
                                    "firstName": myname,
                                    "givenName": myname
                                }
                            );
                            Bots.setDelegate({
                             beforeDisplay(messageBody) {
                             if (messageBody.metadata && messageBody.metadata.isHidden) {
                             return null;
                             }
                             return messageBody;
                             }
                             });
                         Bots.sendMessage(messageBody);
                     
                        })
                        .catch(function (err) {
                            console.error(err);
                        });

                 

                Thanks

                Subhajit saha

    • Michael Simonetti

      Any more info on this - as while using sendMessage - it triggers on behalf of user - as we need to send message on behalf of bot

      Thanks

    • Rohit Dhamija

      Try this cross browser code

       

      Bots.setDelegate({ 
      beforeDisplay: function beforeDisplay(messageBody) { 
      if (messageBody.metadata && messageBody.metadata.isHidden) { 
      return null; 

      return messageBody; 

      });