Top Related Projects
The open-source hub to build & deploy GPT/LLM Agents ⚡️
Bot Framework provides the most comprehensive experience for building conversation applications.
Botkit is an open source developer tool for building chat bots, apps and custom integrations for major messaging platforms.
💬 Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants
Quick Overview
Bottender is a modern JavaScript framework for building conversational user interfaces. It provides a unified interface for various messaging platforms, including Messenger, LINE, Slack, Telegram, and more. Bottender aims to simplify the development process of chatbots and conversational applications.
Pros
- Cross-platform support for multiple messaging services
- Easy-to-use API with a consistent interface across platforms
- Built-in session management and state handling
- Extensive documentation and examples
Cons
- Steeper learning curve for developers new to chatbot development
- Limited built-in natural language processing capabilities
- Requires additional setup for each messaging platform
- May be overkill for simple chatbot projects
Code Examples
- Creating a simple echo bot:
const { createServer } = require('bottender/express');
const { router, text } = require('bottender/router');
async function echo(context) {
await context.sendText(context.event.text);
}
const app = router([
text(echo),
]);
const server = createServer(app);
server.listen(5000, () => {
console.log('server is running on 5000 port...');
});
- Handling different types of events:
const { router, text, payload } = require('bottender/router');
async function handleText(context) {
await context.sendText(`You said: ${context.event.text}`);
}
async function handlePayload(context) {
await context.sendText(`You clicked: ${context.event.payload}`);
}
const app = router([
text(handleText),
payload(handlePayload),
]);
- Using session to maintain conversation state:
async function askName(context) {
await context.sendText('What is your name?');
context.session.state = 'asking_name';
}
async function handleName(context) {
const name = context.event.text;
await context.sendText(`Hello, ${name}!`);
context.session.state = 'idle';
}
const app = router([
text('start', askName),
text(context => context.session.state === 'asking_name', handleName),
]);
Getting Started
To get started with Bottender:
-
Install Bottender:
npm install bottender
-
Create a new project:
npx create-bottender-app my-bot cd my-bot
-
Configure your messaging channel in
bottender.config.js
-
Start development:
npm run dev
For more detailed instructions, refer to the official Bottender documentation.
Competitor Comparisons
The open-source hub to build & deploy GPT/LLM Agents ⚡️
Pros of Botpress
- More comprehensive platform with built-in analytics, NLU, and visual flow builder
- Larger community and more extensive documentation
- Supports multiple languages and has a wider range of integrations
Cons of Botpress
- Steeper learning curve due to more complex architecture
- Heavier resource usage, which may impact performance on smaller servers
- Less flexibility for custom implementations compared to Bottender's code-first approach
Code Comparison
Bottender (JavaScript):
const { router, text } = require('bottender/router');
async function App() {
return router([
text('hello', async (context) => {
await context.sendText('Hello, world!');
}),
]);
}
Botpress (JavaScript):
const botpress = require('botpress')
module.exports = async (bp) => {
bp.hear(/hello/i, async (event, next) => {
await event.reply('Hello, world!')
})
}
Both frameworks allow for easy message handling, but Bottender's approach is more declarative and functional, while Botpress uses a more traditional event-based system. Bottender's code is slightly more concise, but Botpress offers more built-in features that may require less custom code overall.
Bot Framework provides the most comprehensive experience for building conversation applications.
Pros of botframework-sdk
- More comprehensive ecosystem with tools for bot development, testing, and deployment
- Supports multiple programming languages (C#, JavaScript, Python)
- Extensive documentation and community support
Cons of botframework-sdk
- Steeper learning curve due to its complexity
- Heavier framework with more dependencies
- Less flexibility for customization compared to Bottender
Code Comparison
botframework-sdk (JavaScript):
const { ActivityHandler, MessageFactory } = require('botbuilder');
class EchoBot extends ActivityHandler {
constructor() {
super();
this.onMessage(async (context, next) => {
await context.sendActivity(MessageFactory.text(`Echo: ${context.activity.text}`));
await next();
});
}
}
Bottender:
module.exports = async function App(context) {
if (context.event.isText) {
await context.sendText(`Echo: ${context.event.text}`);
}
};
Both frameworks provide ways to create chatbots, but Bottender offers a more straightforward approach with less boilerplate code. botframework-sdk provides a more structured class-based approach, which can be beneficial for larger projects. Bottender's simplicity makes it easier to get started, while botframework-sdk's extensive features and cross-platform support make it suitable for complex enterprise applications.
Botkit is an open source developer tool for building chat bots, apps and custom integrations for major messaging platforms.
Pros of Botkit
- Mature and well-established framework with a large community
- Supports a wide range of platforms including Slack, Facebook Messenger, and Twilio
- Offers pre-built plugins and middleware for common bot functionalities
Cons of Botkit
- Less modern syntax and architecture compared to Bottender
- Steeper learning curve for beginners due to its extensive feature set
- Limited built-in support for newer messaging platforms
Code Comparison
Botkit:
const { Botkit } = require('botkit');
const controller = new Botkit({
webhook_uri: '/api/messages',
});
controller.hears('hello', 'message', async(bot, message) => {
await bot.reply(message, 'Hi there!');
});
Bottender:
const { router, text } = require('bottender/router');
async function App(context) {
return router([
text('hello', async (context) => {
await context.sendText('Hi there!');
}),
]);
}
Both frameworks offer straightforward ways to create bot responses, but Bottender's syntax is more modern and concise. Botkit uses a controller-based approach, while Bottender leverages a functional programming style with routers.
💬 Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants
Pros of Rasa
- More comprehensive NLU capabilities with built-in intent classification and entity extraction
- Supports multiple languages out of the box
- Offers both open-source and enterprise versions with additional features
Cons of Rasa
- Steeper learning curve due to more complex architecture
- Requires more setup and configuration compared to Bottender
- May be overkill for simple chatbot projects
Code Comparison
Rasa (Python):
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
class ActionHelloWorld(Action):
def name(self) -> str:
return "action_hello_world"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[str, Any]) -> List[Dict[str, Any]]:
dispatcher.utter_message(text="Hello World!")
return []
Bottender (JavaScript):
const { router, text } = require('bottender/router');
async function HelloWorld(context) {
await context.sendText('Hello World!');
}
module.exports = function App() {
return router([
text('*', HelloWorld),
]);
};
Both repositories offer powerful tools for building chatbots, but they cater to different needs. Rasa is more suitable for complex, multi-language projects requiring advanced NLU capabilities, while Bottender provides a simpler, more lightweight approach for JavaScript developers.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Bottender
The readme below is the documentation for the v1 (stable) version of Bottender. To view the documentation:
- for the latest Bottender version (v1.x), visit https://bottender.js.org/docs/
- for the legacy Bottender version (v0.15), visit https://bottender.js.org/docs/0.15.17/
-
Declarative - Bottender takes care of the complexity of conversational UIs for you. Design actions for each event and state in your application, and Bottender will run accordingly. This approach makes your code more predictable and easier to debug.
-
Native User Experience - Bottender lets you create apps on every channel and never compromise on your usersâ experience. You can apply progressive enhancement or graceful degradation strategy on your building blocks.
-
Easy Setup - With Bottender, you only need a few configurations to make your bot work with channels, automatic server listening, webhook setup, signature verification and so much more.
-
Ready for Production - There are thousands of bots powered by Bottender. It has been optimized for real world use cases, automatic batching request and dozens of other compelling features.
Bottender is built on top of Messaging APIs.
Installation
You can create a new Bottender app using the CLI tools:
npx create-bottender-app my-app
Installation may fail on Windows during compilation of the native dependencies with node-gyp
. To solve this problem, you can install windows-build-tools
or check node-gyp
documentation.
Documentation
You can find the Bottender documentation on the website.
Check out the Getting Started page for a quick overview.
Community
You can discuss anything about Bottender or chatbot development in our Discord Server. Join now!
Examples
We have a bunch of examples in the examples folder. Here is the first one to get you started:
// index.js
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)]);
};
Notable Features
Messenger
- Messenger Profile Sync
- Attachment Upload
- Handover Protocol
- Persona
- Built-in NLP
- Multiple Pages
LINE
- Reply, Push, Multicast, Narrowcast
- Imagemap
- Rich menu
- Room, Group Chat
- Beacon
- Icon Switch
- Line Notify
- LIFF (LINE Front-end Framework)
Slack
- Channel Chat
- Interactive Message
- Slash Command
Telegram
- Webhook, Long Polling
- Updating, Deleting Messages
- Keyboard
- Group Chat
- Inline Query
- Message Live Location
- Payment
Viber
- Subscribed, Unsubscribed Event
- Delivered, Seen Event
Ecosystem
- bottender-compose - An utility library for Bottender and higher-order handlers.
Contributing
Pull Requests and issue reports are welcome. You can follow steps below to submit your pull requests:
Fork, then clone the repo:
git clone git@github.com:your-username/bottender.git
Install the dependencies:
cd bottender
yarn
Make sure the tests pass (including ESLint, TypeScript checks and Jest tests):
yarn test
Make your changes and tests, and make sure the tests pass.
Contribute using the online one-click setup
You can use Gitpod(a free online VS Code-like) for contributing. With a single click it will launch a workspace and automatically:
- clone the bottender repo.
- install the dependencies.
- run
yarn run start
.
So that you can start straight away.
License
MIT © Yoctol
Top Related Projects
The open-source hub to build & deploy GPT/LLM Agents ⚡️
Bot Framework provides the most comprehensive experience for building conversation applications.
Botkit is an open source developer tool for building chat bots, apps and custom integrations for major messaging platforms.
💬 Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot