click to open files

by devmik

HTML

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Create Blob from Uploaded Text File</title>
</head>
<body>
  <input type="file" id="textInput" accept=".txt">

  <script src="https://cdn.botpress.cloud/webchat/v1/inject.js"></script>
<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": "05b1713b-b63d-4c7d-8063-181bd0f9f914",
      "hostUrl": "https://cdn.botpress.cloud/webchat/v1",
      "messagingUrl": "https://messaging.botpress.cloud",
      "clientId": "05b1713b-b63d-4c7d-8063-181bd0f9f914",
      "webhookId": "5f11097c-3813-4932-b00f-a7327cf3ebf0",
      "lazySocket": true,
      "themeName": "prism",
      "frontendVersion": "v1",
      "useSessionStorage": true,
      "enableConversationDeletion": true,
      "showPoweredBy": true,
      "theme": "prism",
      "themeColor": "#2563eb"
  });
</script>
    
    <script>
      window.botpressWebChat.onEvent(
        (event) => {
          if (event.type === 'TRIGGER') {
            console.log('This also works now!')
            function openFiles() {
              textInput.click();
            }
            openFiles();
          }
        },
        ['TRIGGER']
      );
  </script>
</body>
</html>