Skip to main content

Welcome Bot

A bot that monitors signal chat groups and posts a message when people join

Getting Started

Note: this is a work in progress. These setup instructions are very rough and will be evolving rapidly.

Create a local volume to hold the state of the signal-api and the welcomebot. This volume will be replaced by an encrypted volume in the cloud:

docker volume create welcomebot_state

Also create a bridge nwork that you will need later:

docker network create --driver bridge signal

Register your account with signal-api, but link the volume in a little higher in the filesystem so we can use the volume for other state sotrage as well:

docker run --detach --name signal-api -p 8080:8080 \
      --volume welcomebot_state:/home/.local \
      --network signal \
      -e 'MODE=json-rpc' bbernhard/signal-cli-rest-api

Open the registration QR code at http://localhost:8080/v1/qrcodelink?device_name=welcome-bot And scan it with the "link account" flow from the phone with the bot account.

Note that the bot will have access to all the contacts and chats of the account you link it to. You should not use your personal Signal account for this. You should get a separate phone number, create a Signal account with that number, and then use that account only for the bot.

Replace 12125551212 with the bot's phone number and execute these commands.

curl http://localhost:8080/v1/groups/+12125551212
curl http://localhost:8080/v1/contacts/+112125551212

If you are using a fresh Signal account (you are, right?), then they should both return an empty result: [].

Send the bot account a message from the account you want it to trust as the management account. Accept that message as the bot using the phone. Then invite it to a group chat with a title you will remember, like "Welcomebot Control Room".

Rerun those curl commands above and look for the new (only!) responses.

The value WELCOME_MANAGER will be the uuid of your entry in the response to the contacts query. The value of WELCOME_CNC will be the internal_id in the response to the groups query.

Now create .env with:

SIGNAL_SERVICE=localhost:8080
PHONE_NUMBER=...
WELCOME_MANAGER=...
WELCOME_CNC=...

Then test locally with:

uv sync
uv run pytest
uv run python -m welcomebot

If you send the message "help" to the bot in the CNC channel, it should reply with a help message.

containerized!

Now you should be able to copy your local state to a volume and run the bot in it's own container:

# copy state into the volume
docker build -f copypaste.dockerfile -t copypaste .
docker run -it -v ~/.local/share:/home/a -v wecomebot_state:/home/b copypaste

# run the bot
docker build -f docker/welcomebot.dockerfile \
      --build-arg WELCOMEBOT_VERSION=0.1.8 \
      -t welcomebot:v0.1.8 .
docker run -d --name welcomebot --rm \
     -v welcomebot_state:/home/.local \
     --env-file .env \
     --network container:signal-api \
     welcomebot:v0.1.8

compose

Stop the other containers and use compose.yaml config to bring the services up together:

docker compose up

controlling the bot

  • send help to the bot in the CNC chat
  • invite the bot to a group you want to manage
  • send list_groups to the bot in the CNC chat
  • set the welcome mesage for the group:
set_motd 0
hello and welcome to the chat.
please adhere to group guidlines at
https://codeforamerica.org/code-of-conduct/

Release Process

uv run pytest
uv version --bump patch
version=$(uv version --short)
tag=v$version
git commit -S -a -m "publishing $tag"
git tag -m "publishing $tag" $tag
git push github
git push github tag $tag 

Primary Dependancies

Metadata

Release files for welcomebot 0.2.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for welcomebot 0.2.7
File Size Uploaded
welcomebot-0.2.7.tar.gz 13.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for welcomebot 0.2.7
File Interpreter ABI Platform
welcomebot-0.2.7-py3-none-any.whl Python 3 none any Details

Total release size: 27.5 kB

Release files / welcomebot-0.2.7.tar.gz

Download URL welcomebot-0.2.7.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
163c14e47d9d5a99e533d61a608b6b1775d84a2dcac3fd969d3466e307386bc4
BLAKE2b-256 checksum
How to use checksums
069dd15d2181af8872f8517348cbc4d5b6c5f70677ce71efdc3c0ce7b21d79a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / welcomebot-0.2.7-py3-none-any.whl

Download URL welcomebot-0.2.7-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
201e3e11dd202e7fb8e5c231d549fc367fca7992cdbad494d9c0863699c7547a
BLAKE2b-256 checksum
How to use checksums
37632ff96ec9285428bfc88026306e326c3da4ea45837cca19848b6e9e7f2d55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.3.1

2 release files

0.3.0

2 release files

0.2.11

2 release files

0.2.8

2 release files

This release

0.2.7 This release

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

1 release file

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

1 release file

0.1.2

1 release file

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page