Skip to content

JeremyGDiamond/signal-info-bot

Repository files navigation

signal-info-bot

Welcome and info bot for signal groups based on signal cli

Setup

Setup your config file

  • make a copy of exampleConfig.json and rename it to config.json
  • modify config.json to meet the needs of your group (use signal-cli commands to get group id numbers and uids)
  • repeat the above with testConfig.py

Local

This project can be installed locally on any Linux distro with the signal cli. tested on ubuntu 22.04 and nixos. It is recommended that you use a dedicated account for this bot.

  1. Install dependencies
  2. Connect signal
    • Run ./linkAccount.sh and go to link account in the signal app. Scan the QR code that is generated.
  3. Run Tests
    • python3 tests.py and check the output and signal behaviors
  4. Run Bot
    • python3 main.py

Docker

Run make runNew to build the container and run it the first time

Each make run will need to be linked to the signal account and the old one should be removed before a new one is made

Run make restart to restart an exiting container and not need to relink everything

Run make run to update to a new config file

Command Convention

All commands must be one word all lower case. The bot will have a default group if you want to use a different group follow the command with the group name.

Welcome

Every group has a welcome message that will be sent to all new members in 10 minutes or less after joining. This message can be called again with the welcome command

Help

Every group has a help message that is autogenerated with the group name, instructions on how to use it and the commands for that group. This can be called with the help command.

config files

Configs are stored as json objects with the following structure

{
    "myPhone":"+999999999999",
    "socketFile" : "/tmp/signal-cli/socket",
    "admin" : "+999999999999",
    "noteToSelfMode" : false,
    "testDmId" : "1a1a1a1a-2b2b-3c3c-4d4d-5e5e5e5e5e5e",
    "testGrId" : "HGSyrEtFZ1PTtq/StflWB4SLW63W72koA8htz3kgMdn=",
    "default": "HGSyrEtFZ1PTtq/StflWB4SLW63W72koA8htz3kgMdn=",
    "groups" : {
        "HGSyrEtFZ1PTtq/StflWB4SLW63W72koA8htz3kgMdn=" : {
            "welcomeMessage" : "bot: test Welcome message",
            "commands" : {
                "test" : ["bot: test command from config", "test descrition for the test config"]
            }
        }
    },
    "testValidMessage" : "Envelope from: “uname” 1a1a1a1a-2b2b-3c3c-4d4d-5e5e5e5e5e5e (device: 1) to +999999999999\nTimestamp: 1735384037398 (2024-12-28T11:07:17.398Z)\nServer timestamps: received: 1735384035660 (2024-12-28T11:07:15.660Z) delivered: 1735384058760 (2024-12-28T11:07:38.760Z)\nSent by unidentified/sealed sender\nMessage timestamp: 1735384037398 (2024-12-28T11:07:17.398Z)\nBody: Help\nWith profile key",
    "testInvalidMessage" : "Envelope from: “uname” lsacnalcn!#@$ (device: 1) to +999999999999\nTimestamp: 1735384037398 (2024-12-28T11:07:17.398Z)\nServer timestamps: received: 1735384035660 (2024-12-28T11:07:15.660Z) delivered: 1735384058760 (2024-12-28T11:07:38.760Z)\nSent by unidentified/sealed sender\nMessage timestamp: 1735384037398 (2024-12-28T11:07:17.398Z)\nBody: Help\nWith profile key"
    
}

myPhone: user's phone number

socketFile: The temp file used for the unix socket on your system. What files are availible might vary

admin: contact for the admin that gets alerts, can be a phone or a uid

notetoSelfMode: are erros sent to note to self

testDmId: contact for the test script to send dm's, can be a phone or a uid

testGrId: group to send test messages, a dedicated group is best for this

default: The defualt group

groups: A collection of groups the bot will work with

  • welcomeMessage: Every group needs a welcome message to send to new members when they join
  • commands: An array of key value pairs that follow the structure of
"commands" : {
             "commandName" : ["Command response", "Command description"]
         }

testValidMessage: A message captured from signal-cli receive to be used by tests.py

testInvalidMessage: message captured from signal-cli receive and corrupted to be invalid to be used by tests.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published