This repository has been archived by the owner on Apr 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Twilio
Yuri Schimke edited this page Jul 18, 2018
·
23 revisions
brew install yschimke/tap/okurl
- Register with Twilio here - https://www.twilio.com/try-twilio
- Visit Twilio Console to get your credentials.
Store credentialsokurl --authorize twilio
- Visit https://www.twilio.com/console/phone-numbers/search to register a number to send SMS from.
- Send SMS
twiliosend +15550010001 Hey from Twilio
- Read SMS
twiliolist
twilioapi -> https://api.twilio.com/2010-04-01/Accounts/XXXXXXX{0}
twiliosend +15550010001 Message to send -> POST https://api.twilio.com/2010-04-01/Accounts/XXXXXXX/Messages.json
twiliolist -> https://api.twilio.com/2010-04-01/Accounts/XXXXXXX/Messages.json
https://www.twilio.com/docs/api/rest/account https://www.twilio.com/user/account/messaging/dev-tools/api-explorer/message-create
Authenticate to access your account
$ okurl --authorize twilio
Twilio Account SID []: xxxxxxxxxxxxx
Twilio Auth Token []:
See Accounts
$ twilioapi /2010-04-01/Accounts.json
{
"first_page_uri": "/2010-04-01/Accounts.json?Page=0&PageSize=50",
"end": 0,
"previous_page_uri": null,
"uri": "/2010-04-01/Accounts.json",
"page_size": 50,
"start": 0,
"accounts": [
{
...
Send SMS (simple)
twiliosend +15550010001 Hey from Twilio
Send SMS (full)
$ twilioapi -d "To=%2B15550010000&Body=Hello&From=%2B15550020000" /Messages.json
{
"sid": "SSSSSSSSSSSSS",
"date_created": "Sat, 25 Jun 2016 15:09:34 +0000",
"date_updated": "Sat, 25 Jun 2016 15:09:34 +0000",
"date_sent": null,
"account_sid": "AAAAAAAAAAA",
"to": "+15550010000",
"from": "+B15550020000",
"messaging_service_sid": null,
"body": "Hello",
"status": "queued",
"num_segments": "1",
"num_media": "0",
"direction": "outbound-api",
"api_version": "2010-04-01",
"price": null,
"price_unit": "USD",
"error_code": null,
"error_message": null,
"uri": "/2010-04-01/Accounts/AAAAAAAAAAA/Messages/XXXXXXXXXXX.json",
"subresource_uris": {
"media": "/2010-04-01/Accounts/AAAAAAAAAAA/Messages/XXXXXXXXXX/Media.json"
}
}
See Incoming SMS (simple)
$ twiliolist
+15550010001 Hey
+15550010002 Test
See Incoming SMS (full)
$ twilioapi '/Messages.json?PageSize=100' | jq -r '.messages[] | select(.direction == "inbound") | [.from, .body] | @tsv'
+15550010002 Test
Full URL Path
$ okurl https://api.twilio.com/2010-04-01/Accounts.json