Skip to main content

Bottender 1.0: Create Bottender App, Router, Action Runner and Bottender.js.org

· 5 min read
C. T. Lin

We're very proud to announce the production-ready Bottender 1.0 today, featuring:

Checkout v1 changelog and migration guide for more details.

Create Bottender App

create-bottender-app is the best way to start building a new application in Bottender. It saves significant your time from installing packages and writing boilerplates.

You can start a multi-channel bot with only one command:

$ npx create-bottender-app my-app

Conversation Made Easy and Simple

While Bottender v0 focused on Making Bots, Bottender v1 retargeted on Conversational User Interface. You may notice that Bottender's new tagline, "a framework for building conversational user interfaces."

When it comes to commercial bot projects, we found that complicated messaging applications are not avoidable. To make the code easy to read and maintain, we introduced a new primitive, Action. Actions are the smallest building blocks of Bottender apps. Meanwhile, with Actions, Bottender users can benefit from the functional declarative world.

async function SayHi(context) {
await context.sendText('Hi!');
}

Conversation Router

With Bottender v1, you can use the new Router to organize your conversations. It's declarative and easy to read. Also, it makes debug very straightforward.

const { router, text } = require('bottender/router');

async function SayHi(context) {
await context.sendText('Hi!');
}

async function Unknown(context) {
await context.sendText('Sorry, I don’t know what you say.');
}

module.export = function App(context) {
return router([
text('hi', SayHi), //
text('*', Unknown),
]);
};

Action Runner

Bottender v1 introduces a new built-in Action Runner in the core, which makes Bottender as the command center of actions. Action Runner is a flexible and clear working pattern. It helps developers focus on implementing actions corresponding to different contexts. On the other hand, it also offers developers enormous possibilities for customization features.

const { withProps } = require('bottender');

const { router, text } = require('bottender/router');

async function SayHi(context, { name }) {
await context.sendText(`Hi! ${name}.`);
}

async function SayHiToJohn(context) {
return withProps(SayHi, { name: 'John' });
}

async function App(context) {
return router([
text('hi', SayHiToJohn), //
text('*', Unknown),
]);
}

Plus, Action Runner allows Bottender to have better control of conversation flow. For example, you may use debug environment variable DEBUG=bottender:action to debug how your app handling events:

Integrating with Natural Language Understanding (NLU)

Natural Language Understanding (NLU) is a critical factor of conversational business. Thanks to the growing machine learning and deep learning techniques, data scientists have made significant progress in the area of understanding human language in the past few years.

Therefore, we rethink the best practices about how to use NLU techniques with Bottender. You can find Bottender official guides and examples for the modern NLU solutions:

Fundamentally Rewritten in TypeScript

Static typing in JavaScript is one of the most impactful trending in the last few years. We adapt it to improve code reliability dramatically.

Although we had embraced Flow Tye two years ago, we found TypeScript grows much faster and mature, owns better developer communities. Bottender v1 has fundamentally rewritten in TypeScript.

Since Bottender is created for developers by developers, developer experience is a critical factor we always pursuit. TypeScript offers a better developer experience, e.g., dynamic tips, as you coding with VSCode.

Bottender.js.org

We are very happy to introduce the new Bottender document site, bottender.js.org, built by Bottender core contributor Evan Ye.

We have fully understood the importance of official documents and examples. Several team members are dedicated to the endless wish list of docs and examples. You can always expect new docs release every week. Last but not least, API doc is also available.

Tweet us if you want to read any specific topics! We are trying to give you an answer (even due day) as soon as possible.

Thanks to the super powerful doc site package, Docusaurus and Docsearch, all documents on bottender.js.org are versioned and searchable by heading:

Preview Website on the PR

Every time a change happens inside a PR, Netlify automatically deploys it and make the preview of it ready.

What's Next

Since we have allocated enough resources to make Bottender active, you can keep an eye on our ambitious roadmap in this issue. Future item priorities are always dynamic, tweet us if you want to upvote any of it.

In the following section, you can find out two major coming features.

Slot Filling

The multi-turn conversation is a daily chat pattern. It is used to get every detail for a particular scenario, e.g., booking a hotel, searching for the right gift. The most common way to achieve the multi-turn conversation is Slot Filling.

We already experimented with it in the past few months and made significant progress. You can expect a deep integration between Slot Filling of Dialogflow and Bottender in the near future.

Serverless Support

Chatbot is one of the best applications for serverless computing. Simplified HTTP adapter APIs of Bottender v1.0 makes it possible. In the near future, we are planning to support the following serverless computing:

  • AWS lambda
  • Google cloud functions
  • Azure functions
  • Zeit Now 2.0