A library for creating bots that interact with the Signal application. Not affiliated with the Signal project or Open Whisper Systems.
Install with npm install signal-bot
.
Currently only works on Linux, with Node.js >=14.0.0.
This library requires a working installation of signal-cli running in daemon mode with the phone number you want to use. Use this Python script for an easy installation process.
Tested on v0.7.2 of signal-cli.
const {Client} = require("signal-bot");
const bot = new Client();
const prefix = "!";
bot.on("message", msg => {
if (!msg.content.startsWith(prefix)) return;
const command = msg.content.slice(prefix.length);
if (command === "hello") {
msg.conversation.sendMessage("Hello World!");
} else if (command === "whoami") {
msg.conversation.sendMessage(`You are ${msg.author.id}`);
}
});
bot.connect();
Send the bot !hello
and it should respond with Hello World!
.
Send the bot !whoami
and it should respond with You are <phone number>
.
- signal-cli D-Bus missing features:
- Group conversation invite event
- Group conversation leave event
- Reactions
- Stickers
- Contact management
- Additional user/group member information/profiles
- Group conversation member list
- Group conversation admin functions