diff --git a/docs/usage/messages.rst b/docs/usage/messages.rst index bc8c1f3..3dc2669 100755 --- a/docs/usage/messages.rst +++ b/docs/usage/messages.rst @@ -2,7 +2,7 @@ SMS Messages ============ -For more information, see the `SMS Message REST Resource `_ documentation. +For more information, see the `SMS Message REST Resource `_ documentation. Sending a Text Message ---------------------- @@ -20,11 +20,33 @@ Send a text message in only a few lines of code. 'From' => '+15555555555', 'Body' => 'Hello!' }; - TwilioSMS message = client.getAccount().getSmsMessages().create(properties); + TwilioMessage message = client.getAccount().getMessages().create(properties); .. note:: The message body must be less than 160 characters in length +Sending a MMS +---------------------- + +Send a MMS in only a few lines of code. + +.. code-block:: javascript + + String ACCOUNT_SID = 'AXXXXXXXXXXXXXXXXX'; + String AUTH_TOKEN = 'YYYYYYYYYYYYYYYYYY'; + TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN); + + List properties = new List(); + properties.add(new TwilioNameValuePair('To','+13216851234')); + properties.add(new TwilioNameValuePair('From','+15555555555')); + properties.add(new TwilioNameValuePair('MediaUrl','https://www.twilio.com/packages/company/img/logos_downloadable_round.png')); + + TwilioMessage message = client.getAccount().getMessages().create(properties); + + +.. note:: The message body must be less than 160 characters in length + + If you want to send a message from a `short code `_ on Twilio, just set :attr:`From` to your short code's number. diff --git a/src/classes/TwilioNameValuePair.cls b/src/classes/TwilioNameValuePair.cls new file mode 100644 index 0000000..fd13256 --- /dev/null +++ b/src/classes/TwilioNameValuePair.cls @@ -0,0 +1,23 @@ +/** + * This class is used to hold a key/value POST param. + */ +global class TwilioNameValuePair { + + private String name; + + private String value; + + public TwilioNameValuePair(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + +} \ No newline at end of file diff --git a/src/classes/TwilioNameValuePair.cls-meta.xml b/src/classes/TwilioNameValuePair.cls-meta.xml new file mode 100644 index 0000000..f165265 --- /dev/null +++ b/src/classes/TwilioNameValuePair.cls-meta.xml @@ -0,0 +1,5 @@ + + + 29.0 + Active + diff --git a/src/package.xml b/src/package.xml index 9e86624..b6c91c4 100755 --- a/src/package.xml +++ b/src/package.xml @@ -27,6 +27,7 @@ TwilioMemberList TwilioMessage TwilioMessageList + TwilioNameValuePair TwilioNotification TwilioNotificationList TwilioOutgoingCallerId @@ -50,7 +51,6 @@ TwilioTranscription TwilioTranscriptionList TwilioTwiML - TwilioNameValuePair Twilio_TestAccounts Twilio_TestApplication Twilio_TestCalls