Single choice button

by devmik

HTML

<html>

  <body>
    <h1>
      Click me!
    </h1>
    <script src="https://cdn.botpress.cloud/webchat/v1/inject.js"></script>
    <script>
      window.botpressWebChat.init({
        "composerPlaceholder": "Chat with bot",
        "botConversationDescription": "This chatbot was built surprisingly fast with Botpress",
        "botId": "1c46795c-27f3-4f05-bdbd-1c876cbcbf05",
        "hostUrl": "https://cdn.botpress.cloud/webchat/v1",
        "messagingUrl": "https://messaging.botpress.cloud",
        "clientId": "1c46795c-27f3-4f05-bdbd-1c876cbcbf05",
        "webhookId": "87abb531-1b6c-406c-b428-b33dcdaeaa80",
        "lazySocket": true,
        "themeName": "prism",
        "frontendVersion": "v1",
        "useSessionStorage": true,
        "enableConversationDeletion": true,
        "showPoweredBy": true,
        "theme": "prism",
        "themeColor": "#2563eb"
      });

    </script>
    <button id="yesButton">YES</button>
    <button id="noButton">NO</button>

    <script>
      document.getElementById('yesButton').addEventListener('click', function() {
        window.botpressWebChat.sendPayload({
          type: 'text',
          text: "Yes"
        });
      });
      document.getElementById('noButton').addEventListener('click', function() {
        window.botpressWebChat.sendPayload({
          type: 'text',
          text: "No"
        });
      });

    </script>
  </body>

</html>