An open API service indexing awesome lists of open source software.

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

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"

```