JSFiddle - React, Tailwind, and code Playground

by Decay15

HTML

<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": "7ffd5036-6edf-4850-ab6e-ac5cdc7db653",
      "hostUrl": "https://cdn.botpress.cloud/webchat/v1",
      "messagingUrl": "https://messaging.botpress.cloud",
      "clientId": "7ffd5036-6edf-4850-ab6e-ac5cdc7db653",
      "webhookId": "3e8f3795-6c0c-4b89-9384-5a79dc9270d5",
      "lazySocket": true,
      "themeName": "prism",
      "frontendVersion": "v1",
      "showPoweredBy": true,
      "enableConversationDeletion": true,
      "theme": "prism",
      "themeColor": "#2563eb"
  });
</script>

JavaScript

window.botpressWebChat.onEvent(
        function (event) {
          if (event.type === 'LIFECYCLE.LOADED') {
            window.botpressWebChat.sendEvent({ type: 'show' })
          }
        },
        ['LIFECYCLE.LOADED']
      )
      
    window.botpressWebChat.onEvent(event => {
        if (event.type === 'TRIGGER') {
            if (event.value) {
                console.log(event.value.language);
                window.botpressWebChat.mergeConfig({ locale: event.value.language })
            }
        }
    }, ['TRIGGER']);