Place a Twilio Call from the Shell
The twilio-call bash script will place a phone call to one or more phone numbers provided on the command line, using content read from STDIN! It can practically be used as a drop-in replacement for mail in some instances.
The bash script leverages the Message Twimlet so no webserver is needed. It just sends a message, either a text string to <Say> or the URL of an audio file to <Play>, to the message Twimlet.
The script can read configuration parameters, such as your Twilio AccountSid, AuthToken and CallerID from the command line, or more preferably from a config file. You can provide the path to a config file in the arguments, or the default ~/.twiliorc will be tried.
Additionally, you can provide one or more phone numbers in a single invocation of the script, and all the numbers will be called.
Installation
- Download the twilio-call bash script and put it somewhere in your path.
- chmod 775 twilio-call
- Optional: Setup a default config file in ~/.twiliorc or a location of your choice
Example Usage
Config File
The config file consists of bash variable declarations, as name=value pairs, each on one line. The file may contain any of the following parameters that will be used as defaults and therefore, don't need to be specified on the command line:
| Attribute Name | Description |
|---|---|
| ACCOUNTSID | Your Twilio AccountSid. For example: AC1234567890 |
| AUTHTOKEN | Your Twilio AuthToken. For example: dk49dkdcb3948abd |
| CALLERID | A valid caller-id configured for your account. For example: 555-867-5309 |
Example Config File
ACCOUNTSID=AC1234567890 AUTHTOKEN=dk49dkdcb3948abd CALLERID=555-867-5309