I have a WordPress website that I built using Elementor, on the website I also have a chatbot that I built using BotPress. I want to do the following function, when a website user clicks on a button, I want it to open or show or trigger the chatbot. How can I do that? [I think there should be a JS code somewhere and a button, but I am not sure of the actual steps and code]
Hi!, this is the code you have to put in your wordpress HTML. The wordpress button you create must add an ID (as in the "myButton" example) so that this script can relate to the button.
Copy code
<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8" />
    <script src="https://cdn.botpress.cloud/webchat/v0/inject.js"></script>
    <script src="https://mediafiles.botpress.cloud/{botId}/webchat/config.js" defer></script>
    <button id="myButton">Click Me!</button>
      function handleClick() {
        console.log('Button clicked!')
          type: 'trigger',
          payload: {
            myCustomProperty: 'hello',
      const button = document.getElementById('myButton')
      button.addEventListener('click', handleClick)
        function (event) {
          if (event.type === 'LIFECYCLE.LOADED') {
            window.botpressWebChat.sendEvent({ type: 'show' })
This code is explained in our documentation https://botpress.com/docs/cloud/toolbox/events-triggers/ 😉
Thanks a lot @billowy-morning-42410 ! Where should I deploy the code exactly if you don't mind me asking :))