This guide will help you set up and run a Signal bot using the Signal CLI REST API. For more details, refer to the [signal cli rest api examples](https://bbernhard.github.io/signal-cli-rest-api/).
The easiest way to get started is using the deployment script:
```sh
git clone https://github.com/kuhyx/signal-bot
cd signal-bot
cp .env.sample .env
# Edit .env with your configuration
./run.sh
```
The `run.sh` script will:
- Create a Python virtual environment if needed
- Install all dependencies
- Load environment variables from `.env`
- Show configuration status and any missing settings
- Start the server with live reload enabled
## Features
- **Live Reload**: Changes to Python files automatically restart the server
- **Debug Mode**: Test the bot locally using "note to self" messages
- **Automatic Deployment**: GitHub Actions workflow deploys to your server on push to main
- **Unit Tests**: Comprehensive test suite for bot functionality
## Debug Mode
Set `MODE=DBG` in your `.env` file to enable debug mode. In this mode:
- Commands are received from your own "note to self" conversation
- Responses are sent back to yourself instead of to a group
- Perfect for testing without affecting real groups
Set `MODE=PRD` for production mode to process group messages normally.
## Configuration
Create a `.env` file (or copy from `.env.sample`) with the following:
```sh
# Your Signal phone number (linked via QR code)
PHONE_NUMBER="+1234567890"
# Group ID where bot receives messages (not needed in debug mode)
GROUP_ID="your-group-id"
# Group ID where bot sends responses (not needed in debug mode)
GROUP_ID_SEND="your-group-id"
# Optional: The Cat API key
CAT_API=""
# DBG for debug mode, PRD for production
MODE=DBG
```
## Automatic Deployment
The repository includes a GitHub Actions workflow (`.github/workflows/deploy.yml`) that automatically deploys to your server when you push to the `main` branch.
### Setting Up Automatic Deployment
Add the following secrets to your GitHub repository (Settings → Secrets and variables → Actions):
-`DEPLOY_HOST`: Your server's hostname or IP
-`DEPLOY_USER`: SSH username
-`DEPLOY_SSH_KEY`: Private SSH key for authentication
-`DEPLOY_PORT`: SSH port (optional, defaults to 22)
-`DEPLOY_PATH`: Path to the bot on your server (optional, defaults to `~/signal-bot`)