Happy !
newapplesho / twilio-smalltalk
Project infos
| License | MIT |
| Tags | twilio, sms, calls |
| Creation date | 2015-08-10 |
| Website | https://github.com/newapplesho/twilio-smalltalk |
Monticello registration
About twilio-smalltalk
twilio-smalltalk
A Smalltalk library for communicating with the Twilio REST API (http://twilio.com). You can get started in minutes using Metacello and FileTree.
Supported Smalltalk Versions
- Pharo Smalltalk 4.0
Installation
Gofer new
url:'http://smalltalkhub.com/mc/newapplesho/twilio-smalltalk/main';
package: 'ConfigurationOfTwilio';
load.
(Smalltalk at: #ConfigurationOfTwilio) 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.'.
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'.
