In this article, we'll be detailing the steps needed to hook up Botpress with Dashbot, a chatbot-specific analytics tool, with a free tier. We're including code you can copy and paste so you can properly catch the most common content response types with little to no work!


Why use something other than Botpress's built-in analytics? External Analytics allows you to pull data out of Botpress and use it in the platform of your choice. If you run different kinds of bots and want to merge them, or want more control over analytics, a dedicated solution like Dashbot can help you manage your analytics with greater ease & control.


About Dashbot

For smaller projects, Dashbot will allow you to monitor engagement to see how your bot is doing generally speaking. You can also look up individual conversations to have a visual understanding of how conversations are going. If your chatbot is starting to take on a high volume, you can use Dashbot to customize your conversation to your liking. You can think of it like having Power BI for chatbot analytics.

Dashbot is free for 1000 messages / month, so you can easily try it out. It also has two other tiers, one for small medium chatbots with a much higher monthly message cap, and a custom Enterprise one. You can pick the plan that suits you.


Instructions


Creating your bot in Dashbot and getting your API key

  1. Go to reports.dashbot.io/signup and create your dashbot account.
  2. Click "Add chatbot".
  3. Fill in the form and submit
  4. Pick any name for your chatbot. This is for your reference only.
  5. Select "Universal" for the platform.
  6. Pick a category that suits your use case.
  7. Select prod or dev. This is for your reference only.
  8. Keep the after submit window open. You will need it to copy the api key later (twice!) and also verify and access the chatbot analytics.


Adding the connection code + right API key in Botpress

  1. Install Botpress (if you haven't already!) and open it.
  2. Create (if you haven't already) and open the bot by clicking its name.
  3. Navigate to the code editor page.
  4. Click the plus button next to "Hooks", select "Event Hooks" -> "Before Outgoing Middleware"
  5. Name your file dashbot-analytics-outgoing.js and submit
  6. In the newly created hook's editor, copy text from here, and paste it into the main content of the hook.
  7. Change the "DASHBOT_KEY" value to the one obtained in step 4.
  8. [Recommended] If you are trying it out the first time, set DEBUG_DEV to true
  9. Hit save
  10. Click the plus button next to "Hooks", select "Event Hooks" -> "After Incoming Middleware"
  11. Name your file dashbot-analytics-incoming.js and submit
  12. In the newly created hook's editor, copy text from here, and paste it into the main content of the hook.
  13. Change the "DASHBOT_KEY" value to the one obtained in step 4.
  14. [Recommended] If you are trying it out the first time, set DEBUG_DEV to true
  15. Hit save
  16. Open the emulator and send a message.


Making sure everything works in Dashbot

  1. Go back to Dashbot and click verify.
  2. If the button's text doesn't show verified, go back and make sure you pasted the right api key, and set DASHBOT_KEY to true before sending a message.
  3. Click the "View Reports" button next to the Verified button.
  4. Have fun poking around your chatbot analytics!



Important - for production

The default behavior is for it to only send analytics if the development flag is set to true (DEBUG_DEV in the two middleware files) or for Production, you need to add an environment variable called EXPOSED_EXTERNAL_ANALYTICS and set it to true. You can add it where you are normally configuring Botpress environment variables.

That's it! Feel free to re-use this code for other tracking purposes. You could even send your analytics to Google Analytics, Segment, or any custom solution. You simply need to adjust the sendAnalytics functions to fit your implementation.

Build better with Botpress

Get started today - it's free!

Related Articles

Culture
March 3, 2022

What’s Happening at Botpress: February 2022

From the European Chatbot & Conversational AI Summit, to the release of new case studies and how-to videos — Here is what happened at Botpress in February 2022. ⬇️

Industry
September 26, 2023

How to Maximize Small Business Growth with Chatbots

Discover the benefits of chatbots and how they can save you time while increasing revenue.

Product
March 28, 2022

Using Botpress v12 Actions with the Giphy API

Learn how to create a chatbot that uses an action to call the Giphy API and provides a gif to the user.

© Botpress 2023