mirror of
https://github.com/nikdoof/smsbot.git
synced 2025-12-11 09:02:16 +00:00
Update README
This commit is contained in:
56
README.md
56
README.md
@@ -12,27 +12,55 @@ The bot is designed to run within a Kubernetes environment, but can be operated
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
All configuration is provided via environment variables
|
SMSBot can be configured using either a configuration file or environment variables. Environment variables will override any values set in the configuration file.
|
||||||
|
|
||||||
| Variable | Required? | Description |
|
### Configuration File
|
||||||
| -------------------------- | --------- | --------------------------------------------------------------------------- |
|
|
||||||
| SMSBOT_DEFAULT_SUBSCRIBERS | No | A list of IDs, seperated by commas, to add to the subscribers list on start |
|
Create a configuration file (e.g., `config.ini`) based on the provided `config-example.ini`:
|
||||||
| SMSBOT_LISTEN_HOST | No | The host for the webhooks to listen on, defaults to `0.0.0.0` |
|
|
||||||
| SMSBOT_LISTEN_PORT | No | The port to listen to, defaults to `80` |
|
```ini
|
||||||
| SMSBOT_OWNER_ID | No | ID of the owner of this bot |
|
[logging]
|
||||||
| SMSBOT_TELEGRAM_BOT_TOKEN | Yes | Your Bot Token for Telegram |
|
level = INFO
|
||||||
| SMSBOT_TWILIO_AUTH_TOKEN | No | Twilio auth token, used to validate any incoming webhook calls |
|
|
||||||
|
[webhook]
|
||||||
|
host = 127.0.0.1
|
||||||
|
port = 80
|
||||||
|
|
||||||
|
[telegram]
|
||||||
|
owner_id = OWNER_USER_ID
|
||||||
|
bot_token = BOT_TOKEN
|
||||||
|
|
||||||
|
[twilio]
|
||||||
|
account_sid = TWILIO_ACCOUNT_SID
|
||||||
|
auth_token = TWILIO_AUTH_TOKEN
|
||||||
|
```
|
||||||
|
|
||||||
|
### Environment Variables
|
||||||
|
|
||||||
|
All configuration options can be overridden using environment variables:
|
||||||
|
|
||||||
|
| Environment Variable | Config Section | Config Key | Required? | Description |
|
||||||
|
| --------------------------- | -------------- | ----------- | --------- | --------------------------------------------------------------------------- |
|
||||||
|
| SMSBOT_LOGGING_LEVEL | logging | level | No | The log level to output to the console, defaults to `INFO` |
|
||||||
|
| SMSBOT_TELEGRAM_BOT_TOKEN | telegram | bot_token | Yes | Your Bot Token for Telegram |
|
||||||
|
| SMSBOT_TELEGRAM_OWNER_ID | telegram | owner_id | No | ID of the owner of this bot |
|
||||||
|
| SMSBOT_TELEGRAM_SUBSCRIBERS | telegram | subscribers | No | A list of IDs, separated by commas, to add to the subscribers list on start |
|
||||||
|
| SMSBOT_TWILIO_ACCOUNT_SID | twilio | account_sid | No | Twilio account SID |
|
||||||
|
| SMSBOT_TWILIO_AUTH_TOKEN | twilio | auth_token | No | Twilio auth token, used to validate any incoming webhook calls |
|
||||||
|
| SMSBOT_WEBHOOK_HOST | webhook | host | No | The host for the webhooks to listen on, defaults to `127.0.0.1` |
|
||||||
|
| SMSBOT_WEBHOOK_PORT | webhook | port | No | The port to listen to, defaults to `80` |
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
To configure SMSBot, you'll need a Twilio account, either paid or trial is fine.
|
To configure SMSBot, you'll need a Twilio account, either paid or trial is fine.
|
||||||
|
|
||||||
* Setup a number in the location you want.
|
1. Copy `config-example.ini` to `config.ini` and update the values, or set the appropriate environment variables.
|
||||||
* Under Phone Numbers -> Manage -> Active Numbers, click the number you want to setup.
|
2. Setup a number in the location you want.
|
||||||
* In the "Voice & Fax" section, update the "A Call Comes In" to the URL of your SMSBot instance, with the endpoint being `/call`, e.g. `http://mymachine.test.com/call`
|
3. Under Phone Numbers -> Manage -> Active Numbers, click the number you want to setup.
|
||||||
* In the "Messaging" section, update the "A Message Comes In" to the URL of your SMSBot instance, with the endpoint being `/message`, e.g. `http://mymachine.test.com/message`
|
4. In the "Voice & Fax" section, update the "A Call Comes In" to the URL of your SMSBot instance, with the endpoint being `/call`, e.g. `http://mymachine.test.com/call`
|
||||||
|
5. In the "Messaging" section, update the "A Message Comes In" to the URL of your SMSBot instance, with the endpoint being `/message`, e.g. `http://mymachine.test.com/message`
|
||||||
|
|
||||||
Your bot should now receive messages, on Telegram you need to start a chat or invite it into any channels you want, then update the `SMSBOT_DEFAULT_SUBSCRIBERS` values with their IDs.
|
Your bot should now receive messages, on Telegram you need to start a chat or invite it into any channels you want, then update the `SMSBOT_TELEGRAM_SUBSCRIBERS` values with their IDs.
|
||||||
|
|
||||||
**Note**: You cannot send test messages from your Twilio account to your Twilio numbers, they'll be silently dropped or fail with an "Invalid Number" error.
|
**Note**: You cannot send test messages from your Twilio account to your Twilio numbers, they'll be silently dropped or fail with an "Invalid Number" error.
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ port = 80
|
|||||||
|
|
||||||
[telegram]
|
[telegram]
|
||||||
owner_id = OWNER_USER_ID
|
owner_id = OWNER_USER_ID
|
||||||
|
subscribers = 1111,2222,3333
|
||||||
bot_token = BOT_TOKEN
|
bot_token = BOT_TOKEN
|
||||||
|
|
||||||
[twilio]
|
[twilio]
|
||||||
|
|||||||
@@ -30,3 +30,6 @@ dev = [
|
|||||||
"ruff>=0.12.9",
|
"ruff>=0.12.9",
|
||||||
]
|
]
|
||||||
github = ["pytest-github-actions-annotate-failures>=0.3.0"]
|
github = ["pytest-github-actions-annotate-failures>=0.3.0"]
|
||||||
|
|
||||||
|
[tool.ruff]
|
||||||
|
line-length = 120
|
||||||
|
|||||||
Reference in New Issue
Block a user