You have created your Botpress bot and now you want to visualize it on your production website, but without exposing it to your customers. How can we achieve this? In this post we will see how to embed and test a Botpress bot on any website.
We will use a similar script which we discussed in one of my previous posts, but this time we will use it along with Tampermonkey, a tool to manage your user scripts and run scripts on the active website.
- Install the Tampermonkey Google Chrome extension using your chrome browser
- Once installed it should appear on your chrome toolbar
- Open any desired website, click on the tampermonkey icon and then “Create a new script…” from the dropdown menu.
- It should open a new tab where we will write our Botpress embed script. Please ensure that @match points to the website on which you want to embed your bot. In my example I am using https://aabingunz.com
- Replace your bot id and bots host port details in below snippet and paste this snippet below “//Your code here…”. Note: Your bot must be served over HTTPs. Please check How to enable HTTPS in Botpress? tutorial for enabling HTTPs on your Botpress bot.
- Save your script and enable your script by toggeling “Enabled” switch in Tampermonkey
- Now open https://aabingunz.com or whatever website you configured. You should be able to see and test your bot.
That’s it. This is how we embed and test a Botpress bot on any website. Let me know in comments what other cool things you can accomplish using Tampermonkey.