Skip to content
Smalltalk library for communicating with the Twilio REST API
Smalltalk
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
pharo-repository
.gitignore
.smalltalk.ston
.travis.yml
LICENSE
README.md

README.md

twilio-smalltalk Build Status

A Smalltalk library for communicating with the Twilio REST API (http://twilio.com). You can get started in minutes using Metacello.

Supported Smalltalk Versions

Installation

Metacello new
    baseline: 'Twilio';
    repository: 'github://newapplesho/twilio-smalltalk:v0.2.1/pharo-repository';
    load.

How to use

You can read official documentation here.

Setup

TwilioSettings default accountSid: 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'.
TwilioSettings default authToken: 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'.

Making a Phone Call

client := TwilioRestClient new.
client makeCallTo: '+14155551212' from: '+14158675309' url: 'http://demo.twilio.com/docs/voice.xml'.

Sending an SMS Message

client := TwilioRestClient new.
client sendTo: '+15558675309' from: '+14158141829' message: 'Sent from Pharo Smalltalk.'.
client sendTo: '+15558675309' from: '+14158141829' message: 'Pharo SmalltalkからSMSを送信'.

Sending an MMS Message

client := TwilioRestClient new.
client sendTo: '+15558675309' from: '+14158141829' message: 'Sent from Pharo Smalltalk.' mediaUrl: 'http://www.example.com/hearts.png'. 

Retrieve All Usage Records

client := TwilioRestClient new.
client accounts usageRecords list.

Retrieve Usage Records

client := TwilioRestClient new.

"Return a single UsageRecord per usage category, for yesterday's usage only."
client accounts usageRecords yesterday list.

"Return a single UsageRecord per usage category, for this month's usage only."
client accounts usageRecords thisMonth list.

Accounts

client := TwilioRestClient new.
"Returns a representation of an account."
client getAccount: 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'. 

Handling Exceptions

client := TwilioRestClient new.
[ client sendTo: '+1' from: '+ 14158141829' message: 'Handling Exceptions test'.] on: TwilioRestException do:[:ex | ex inspect ].
You can’t perform that action at this time.