+0
Daily
16,796
stars
3,706
forks
571
watchers
917
prs
851
issues
82
releases
README
!Pipeline Status
!Build Status: MacOS
!Build Status: Ubuntu
!Build Status: Window
Hubot
Note: v10.0.4 accidentally contains the removal of CoffeeScript; v10.0.5 puts it back in
Note: v11 removes CoffeeScript and converts this codebase to ESM
Hubot is a framework to build chat bots, modeled after GitHub's Campfire bot of the same name, hubot.
He's pretty cool. He's extendable with scripts and can work
on many different chat services.
This repository provides a library that's distributed by npm that you
use for building your own bots. See the documentation
for details on getting up and running with your very own robot friend.
In most cases, you'll probably never have to hack on this repo directly if you
are building your own bot. But if you do, check out CONTRIBUTING.md
Create your own Hubot instance
This will create a directory called myhubot in the current working directory.
sh
npx hubot --create myhubot --adapter @hubot-friends/hubot-slack
npx hubot --create myhubot --adapter @hubot-friends/hubot-discord
npx hubot --create myhubot --adapter @hubot-friends/hubot-ms-teams
npx hubot --create myhubot --adapter @hubot-friends/hubot-irc
Review scripts/example.mjs. Create more scripts in the scripts folder.
Command bus (robot.commands)
Hubot includes a deterministic command subsystem for slash-style commands. It is safe by default and does not interfere with legacy hear and respond listeners.
Basic Command Registration
mjs
export default (robot) = {
robot.commands.register({
id: 'tickets.create',
description: 'Create a ticket',
aliases: ['ticket new', 'new ticket'],
args: {
title: { type: 'string', required: true },
priority: { type: 'enum', values: ['low', 'medium', 'high'], default: 'medium' }
},
sideEffects: ['creates external ticket'],
handler: async (ctx) = {
return Created ticket: ${ctx.args.title}
}
})
}
Invoke with addressing the bot:
- @hubot tickets.create --title "VPN down" --priority high
- @hubot tickets.create title:"VPN down" priority:high
Commands that declare side effects will require confirmation before execution.
The user is asked to confirm. They do so like so:
sh
@hubot yes
@hubot no
@hubot cancel
Aliases are for discovery and search only. They do not execute commands or create proposals. They are intent utterances.
Built-in Help Command
Hubot automatically registers a help command that provides command discovery and documentation:
@hubot help List all commands
@hubot help tickets Filter commands by prefix
@hubot help search "create ticket" Search by keyword, alias, description, or example
Search for Commands
mjs
const results = robot.commands.search('ticket new')
// [{ id: 'tickets.create', score: 100, matchedOn: 'alias' }, ...]
Custom Type Resolvers
Extend validation with custom argument types:
mjs
export default (robot) = {
// Register custom type resolver
robot.commands.registerTypeResolver('project_id', async (vTop issues
#742Add an API for listing users in a room/channel9 comments · 2014-08-12#1730https://hubot.github.com is outdated and confusing3 comments · 2024-08-22#1446Standardize reaction receiving and posting1 comments · 2018-05-13#1812Can we ust `npm create hubot` to scaffold a project?0 comments · 2026-01-19
Discussions
#1723Converting old hubot external scripts from coffeescript to mjs?1 comments · 2024-04-16#1716Hubot Brain not loading?2 comments · 2024-03-04#1704Replacing express with forked version1 comments · 2023-12-05#1686How do we get dotenv working?1 comments · 2023-11-02#1656Version ranges for Hubot packages5 comments · 2023-08-01#1628Ben x pilotunuz1 comments · 2023-05-22#1589Welcome to hubot Discussions!0 comments · 2023-04-18#1591Hubot overloading Slack API calls while running on PCF4 comments · 2019-03-29
Latest release
v14.1.1 v14.1.1 2026-10-2814.1.1 (2026-10-28) Bug Fixes create: install the default scripts on Windows (1840) (083df91)