botman / web-widget

MIT License
38 stars 68 forks source link

How to execute the js code written in conversation file #12

Closed sunstar20 closed 6 years ago

sunstar20 commented 6 years ago

Hi Team,

Could you please tell me how to execute the js code (i.e alert the message 'test' when the button value is 'yes') written in conversation file.

else { $this->say("Sorry, I didnt understand..."); $questionContact = Question::create("Would you like to chat with agent") ->addButtons([ Button::create('Yes')->value('yes'), Button::create('No')->value('no'), ]);

        return $this->ask($questionContact, function (Answer $answer)
        {
            if ($answer->isInteractiveMessageReply()) {
                if ($answer->getValue() === 'yes') {
                   echo "<script>alert('test')</script>";
                } else if ($answer->getValue() === 'no') {
                    $this->say("no");
                }
            }
        });
      }

Currently, the response is given as: 1{"status":200,"messages":[]}

Please help.

Thanks in advance

sschlein commented 6 years ago

Hi,

can you please ask this question in the forum at https://botman.io/forum/ ?

Github issues are for bugs and we are trying to collect the knowledge ans answers of all questions in the forum to get a database that can be searched.

Many thanks Sebastian