Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1 from loopingrage/master

Added fenced code blocks (w/ JS syntax) around README samples
  • Loading branch information...
commit 3fac5f078ceca81de70902e043f527dbbe6b1763 2 parents 0c20c9f + e872b53
@loopingrage loopingrage authored
Showing with 59 additions and 43 deletions.
  1. +59 −43 README.md
View
102 README.md
@@ -23,67 +23,83 @@ Usage Examples
The following simple example will send an outbound SMS message from (407) 554-1234 to (518) 476-1234 and write out the JSON response from SMSified to the console:
- var sys = require('sys');
- var smsified = require('smsified');
-
- var sms = new SMSified('username', 'password');
- var options = {senderAddress: '4075541234', address: '15184761234', message: 'Hello world from Node.js'};
- sms.sendMessage(options, function(result) {
- sys.puts(sys.inspect(result));
- });
+```js
+var sys = require('sys');
+var smsified = require('smsified');
+
+var sms = new SMSified('username', 'password');
+var options = {senderAddress: '4075541234', address: '15184761234', message: 'Hello world from Node.js'};
+sms.sendMessage(options, function(result) {
+ sys.puts(sys.inspect(result));
+});
+```
Send an outbound SMS message and set a callback URL:
- var sms = new SMSified('username', 'password');
- var options = {senderAddress: '4075541234', address: '15184761234', message: 'Hello from Node.js with another callback', notifyURL: 'http://path-to-somewhere/'};
- sms.sendMessage(options, function(result) {
- sys.puts(sys.inspect(result));
- });
+```js
+var sms = new SMSified('username', 'password');
+var options = {senderAddress: '4075541234', address: '15184761234', message: 'Hello from Node.js with another callback', notifyURL: 'http://path-to-somewhere/'};
+sms.sendMessage(options, function(result) {
+ sys.puts(sys.inspect(result));
+});
+```
Check the status of an SMS message:
- var sms = new SMSified('username', 'password');
- sms.checkStatus('4075541234', '43d2f75b2bda27006200003e9b7dcf3b', function(result) {
- sys.puts(sys.inspect(result.deliveryInfoList.deliveryInfo));
- });
+```js
+var sms = new SMSified('username', 'password');
+sms.checkStatus('4075541234', '43d2f75b2bda27006200003e9b7dcf3b', function(result) {
+ sys.puts(sys.inspect(result.deliveryInfoList.deliveryInfo));
+});
+```
Create a subscription for an account phone number:
- var sms = new SMSified('username', 'password');
- sms.createSubscription('4075541234', 'outbound', 'http://path-to-somewhere', function(result) {
- sys.puts(sys.inspect(result));
- });
+```js
+var sms = new SMSified('username', 'password');
+sms.createSubscription('4075541234', 'outbound', 'http://path-to-somewhere', function(result) {
+ sys.puts(sys.inspect(result));
+});
+```
View all active subscriptions:
- var sms = new SMSified('username', 'password');
- sms.viewSubscriptions('4075541234', 'outbound', function(result) {
- sys.puts('Number of subscriptions: ' + result.outboundSubscriptionList.numberOfSubscriptions);
- sys.puts(sys.inspect(result.outboundSubscriptionList.outboundSubscription));
- });
+```js
+var sms = new SMSified('username', 'password');
+sms.viewSubscriptions('4075541234', 'outbound', function(result) {
+ sys.puts('Number of subscriptions: ' + result.outboundSubscriptionList.numberOfSubscriptions);
+ sys.puts(sys.inspect(result.outboundSubscriptionList.outboundSubscription));
+});
+```
Delete a subscription:
- var sms = new SMSified('username', 'password');
- sms.deleteSubscriptions('6267217aae394b5dc656ba4216082304', 'outbound', function(result) {
- if(result = '204') {
- sys.puts('Subscription delted.');
- }
- else {
- sys.puts('Could not delete subscription.');
- }
- });
+```js
+var sms = new SMSified('username', 'password');
+sms.deleteSubscriptions('6267217aae394b5dc656ba4216082304', 'outbound', function(result) {
+ if(result = '204') {
+ sys.puts('Subscription delted.');
+ }
+ else {
+ sys.puts('Could not delete subscription.');
+ }
+});
+```
Retrieve delivery information on a message:
- var sms = new SMSified('username', 'password');
- sms.getMessages('02b45e3072ae5e157a12d0408bcede65', null, function(result) {
- sys.puts(sys.inspect(result));
- });
+```js
+var sms = new SMSified('username', 'password');
+sms.getMessages('02b45e3072ae5e157a12d0408bcede65', null, function(result) {
+ sys.puts(sys.inspect(result));
+});
+```
Retrieve delivery information on a set of messages, using filters to specify messages:
- var sms = new SMSified('username', 'password');
- sms.getMessages(null, {status: 'success', direction: 'in'}, function(result) {
- sys.puts(sys.inspect(result));
- });
+```js
+var sms = new SMSified('username', 'password');
+sms.getMessages(null, {status: 'success', direction: 'in'}, function(result) {
+ sys.puts(sys.inspect(result));
+});
+```
Please sign in to comment.
Something went wrong with that request. Please try again.