diff --git a/README.md b/README.md index 28d168f..79e743f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,35 @@ # Twilio2Telegram -Forward SMS from your Twilio number to Telegram +Forward SMS and Calls from your Twilio number to Telegram + +## Usage + +### Clone the repository + +`git clone git@github.com:FiveBoroughs/Twilio2Telegram.git` + +### Set the envirronement variables + +`cp sample.env .env && vim .env` + +Create your bot and obtain the BotToken by following the BotFather instructions : t.me/botfather + +Get the telegram owner and subscribers chat id by talking to the bot in telegram, and watching this url `https://api.telegram.org/bot/getUpdates` + +And the Twilio Token from twilio.com/console : hidden behind the "View" button, next to auth token + +### Launch the docker container + +`docker-compose up -d` + +### Set the Twilio webhooks destination + +Click on the desired number twilio.com/console/phone-numbers/incoming + +And add the domain or ip of the server hosting Twilio2Telgram, `/call` for calls and `/message` for messages + +![Twilio Webhooks settings](/static/Screenshot_twilio_webhook_settings.png) + +Optional : +Twilio2Telegram listens for webhook calls on the 8080 port. +If you want to add https and user the port 80, set up a reverse proxy on the machine diff --git a/Twilio2Telegram.py b/Twilio2Telegram.py index cd50f1f..8bfc394 100644 --- a/Twilio2Telegram.py +++ b/Twilio2Telegram.py @@ -51,15 +51,13 @@ def tg_error_handler(update, context): def tg_bot_start(): """Start the telegram bot.""" - # Create the Updater and pass it your bot's token. - # Make sure to set use_context=True to use the new context based callbacks - # Post version 12 this will no longer be necessary + # Create the Updater updater = Updater(os.environ.get('TELEGRAM_BOT_TOKEN')) # Get the dispatcher to register handlers dp = updater.dispatcher - # on different commands - answer in Telegram + # on /help command dp.add_handler(CommandHandler("help", tg_help_handler)) # log all errors diff --git a/requirements.txt b/requirements.txt index bb2e47f..e0f2822 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,4 @@ flask -requests -pyOpenSSL waitress twilio python-telegram-bot \ No newline at end of file diff --git a/static/Screenshot_twilio_webhook_settings.png b/static/Screenshot_twilio_webhook_settings.png new file mode 100644 index 0000000..519dbd6 Binary files /dev/null and b/static/Screenshot_twilio_webhook_settings.png differ