https://github.com/thk2b/twilio-cli
Send text messages from the command line with twilio
https://github.com/thk2b/twilio-cli
Last synced: about 1 year ago
JSON representation
Send text messages from the command line with twilio
- Host: GitHub
- URL: https://github.com/thk2b/twilio-cli
- Owner: thk2b
- License: mit
- Created: 2019-05-14T20:27:50.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-15T07:33:55.000Z (about 7 years ago)
- Last Synced: 2024-10-11T14:01:21.903Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# twilio-cli
Send text messages from the command line using twilio.
The script reads from stdin, from a file or directly from an argument.
Specify your twilio credentials as environment variables as options.
## Usage
```
usage: twilio [-h] [--account ACCOUNT_SID] [--token AUTH_TOKEN] [--from FROM]
[--msg MSG | --path PATH] [-v | -q]
to [to ...]
send text messages from the command line
positional arguments:
to
optional arguments:
-h, --help show this help message and exit
--account ACCOUNT_SID, -a ACCOUNT_SID
your twilio account sid. defaults to the
TWILIO_ACCOUNT_SID environment variable
--token AUTH_TOKEN, -t AUTH_TOKEN
your twilio auth token. defaults to the
TWILIO_AUTH_TOKEN environment variable
--from FROM, -f FROM your twilio origin number. defaults to the TWILIO_FROM
environment variable
--msg MSG, -m MSG a message to be sent. defaults to stdin if -p is not
specified
--path PATH, -p PATH a path to a file containing the message to be sent.
defaults to stdin if -m is not specified
-v verbose output
-q supress output
```
## Quick Start
```bash
# install the twilio package
$ pip3 install --user twilio
# export environment variables. See usage for alternatives
$ export TWILIO_ACCOUNT_SID=
$ export TWILIO_AUTH_TOKEN=
$ export TWILIO_FROM=
$ ./twilio -v "+1 234 567 8912" -m "Hello, World"
sending body:
Hello, World
sent sms to +1 234 567 8912
# write message to a file
$ echo "Hello, World, but in a file" > message.txt
$ ./twilio -v "+1 234 567 8912" "+1 9876 543 2109" -p message.txt
sending body:
Hello, World, but in a file
sent sms to +1 234 567 8912
sent sms to +1 9876 543 2109
# reads message from stdin in combination with quiet mode
$ cat message.txt |./twilio -q "+1 234 567 8912" "+1 9876 543 2109"
```