DEV Community

Cameron Bernhardt
Cameron Bernhardt

Posted on

AssumeZero Bot: A Facebook Messenger bot for group chats

My Final Project

For my final project, I thought I'd submit a project I've been working on throughout my entire college career. In a lot of ways, it has grown with me in that time, from a small toy script to a full codebase reflective of all the skills I've learned since I first git init'd.

The simplest description of AssumeZero Bot is this: a chat bot that can be added to Facebook Messenger conversations to control and expose features either hidden or limited by the actual UI. It does this by interfacing with Schmavery's facebook-chat-api, an unofficial Messenger API that works by mimicking user requests made in the browser to trick Messenger into thinking that a real user sent them.

This allows it to be much more functional than Facebook's official API for bots, which only permits direct one-on-one communication with the bot. Pull requests to facebook-chat-api were some of my first open source contributions as I endeavored to add features to my bot that were not yet available in the API.

GitHub logo Schmavery / facebook-chat-api

Unofficial Facebook Chat API for Nodejs

Unofficial Facebook Chat API

npm version npm downloads code style: prettier

Facebook now has an official API for chat bots here.

This API is the only way to automate chat functionalities on a user account. We do this by emulating the browser. This means doing the exact same GET/POST requests and tricking Facebook into thinking we're accessing the website normally. Because we're doing it this way, this API won't work with an auth token but requires the credentials of a Facebook account.

Disclaimer: We are not responsible if your account gets banned for spammy activities such as sending lots of messages to people you don't know, sending messages very quickly, sending spammy looking URLs, logging in and out very quickly... Be responsible Facebook citizens.

See below for projects using this API.

See the full changelog for release details.


If you just want to use facebook-chat-api, you should use this command:

npm install facebook-chat-api


Demo Link

The bot is available on Facebook Messenger, but I won't list the profile here to make it an easy target for being taken down. If you're interested in trying it out, I have instructions for cloning your own instance in the README of the repo.

Link to Code

GitHub logo AstroCB / AssumeZero-Bot

A Facebook Messenger bot for group chats.

AssumeZero Bot


AssumeZero Bot is a highly configurable bot that can be added to Facebook Messenger group chats. It is designed to expose features that may be hidden or made difficult to use by Messenger's UI, both on desktop and mobile. In addition to this functionality, it also connects to several different external services, like Spotify, Wolfram|Alpha, and OpenWeatherMap.

The bot was written with Node.js and the incredible Facebook Chat API, which allows the bot to emulate a Facebook user who can be added and removed from chats. As of this writing, Facebook's official API can still only be used in one-on-one conversations.


Most of the bot's features are activated with a "trigger word," which can be changed in config.js. The default trigger word is "physics" and most commands will be in the form:

physics command [options]

To see a list of commands…

How I built it

From this simple start, I've added tons of features to the bot over the past 4 years, including utility commands for splitting prices, looking up information, doing calculations, creating events and reminders (which Messenger itself no longer supports), and all kinds of other automated tasks that are useful for a group chat. I even added pinging (@ing other users in the chat) before Messenger itself had that feature!

Today, the bot is a fully-fledged service with automated deploys, easy configuration, and most recently, a framework that I've abstracted away to support other bots that I create and spin up new ones quickly: BotCore. AssumeZero Bot and my other Messenger bot projects are now built on BotCore, but BotCore itself was written by pulling out infrastructure that I wrote specifically for AssumeZero Bot and generalizing it to support a network of bot instances.

The bot (and BotCore) are written with NodeJS, fully in JavaScript. There is also a Python library fbchat similar to facebook-chat-api, but I decided to write it using JavaScript because I find it easiest to use for getting projects off the ground quickly, particularly ones that involve a web server. I also wanted to structure the bot's response system asynchronously, and I knew that JavaScript would be my best option for this (particularly back in 2016-2017).

Using Node gave me access to a huge number of packages through npm, which enabled me to add tons of functionality to the bot with ease. For example, the bot contains several image-editing commands powered by jimp. Whenever I was looking for a third-party solution to something, there was always an npm package at the top of the search results that gave me just what I needed.

This probably sounds like an ad for GitHub and its newly-acquired package manager, but I promise it's not! I have just seriously appreciated all of these services over the years, and I want to give credit where credit is due. The open source community has been a joy to work with while building this project and many others throughout college, and I see in hindsight how useful it was for me to have these tools at my disposal.

Top comments (5)

jovvybersamin profile image
Jovvy Bersamin

Man, this looks cool. I was looking for any BOT package that will help me to automate some tasks for my Gaming Group Chat using messenger, luckily I stumbled upon on this thread. It would be a big help how you will setup this on Heroku server with just a small video on youtube.

Thanks man.

hasibulkarimratul profile image

Do you maintain this repo actively?

johnnv profile image


ayoub_51 profile image
Ayoub boueu

Hello, how do I clone the robot into my Facebook account, please?

botolbaba profile image
Mehedi Hasan Ariyan

Awesome. But i don't know How to setup this tool. Please help me to setup this tool. Please 😭😭