Making a Simple Basecamp Chatbot with NodeJS

Creating a chatbot is a fun way to integrate external tool functionality within Basecamp. I recently created one to call the Bitbucket API, allowing us to configure branch permissions on repositories from within Basecamp.

I won’t go into detail about the Bitbucket side of things (it’s a bit of a niche use case!), but I will show you how easy it was to connect this up to Basecamp.

Prerequisites:

  • You need to be an administrator on your account to create a chatbot
  • For this guide you will need an understanding of NodeJS (the chat bot API itself is accessible from other languages too)

The Basecamp API documentation is on GitHub and there is also a page specifically for chatbots if you would like to build your own.

Step 1 – Getting Started:

To get started you need to create a chatbot within Basecamp. To do so, go to any campfire and add /integrations to the url.

Basecamp Integrations Page

Clicking Add a new chatbot will then take you to a page where you can give the chatbot a name, avatar, and (optional) https endpoint to send commands.

Basecamp Chatbot Page

Chatbots work both ways – you can have them automatically send messages to campfires (but not pings) such as when a critical service goes down, or you can make them interactive and have them answer to specific commands from a campfire or direct ping.

Step 2 – The Code:

Here is some example code that uses the standard https module. There is a little extra complexity with setting up an interactive chatbot as you are required to use an https endpoint (which means that you will need to configure SSL).
The example below listens on port 8000, and responds to the command hello.

Step 3 – Using the Chatbot:

You can now call the chatbot using !name in a campfire, or by pinging the chatbot directly.

Basecamp Chatbot Campfire
Basecamp Chatbot Ping

If you’re a first-time reader, or simply want to be notified when we post new articles and updates, you can keep up to date by social media (Twitter, Facebook and Google+) or the Blog RSS.

Related Posts:

The following two tabs change content below.
Leon is a developer at IDRsolutions and product manager for JPDF2HTML5. He is responsible for managing the JPDF2HTML5 product strategy and roadmap, and also spends a lot of his time writing code to build new features, improve functionality, fix bugs, and improve the testing for JPDF2HTML5.
Leon Atherton

About Leon Atherton

Leon is a developer at IDRsolutions and product manager for JPDF2HTML5. He is responsible for managing the JPDF2HTML5 product strategy and roadmap, and also spends a lot of his time writing code to build new features, improve functionality, fix bugs, and improve the testing for JPDF2HTML5.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>