Merge branch 'master' of https://github.com/mediaburst/hackathon-starter into mediaburst-master
* 'master' of https://github.com/mediaburst/hackathon-starter: Update README.md Using the newest clockwork npm package Removed commentted out lines from clockwork.jade Tweak to the clockwork view Adding clockwork SMS to the API mix Conflicts: controllers/api.js package.json
This commit is contained in:
@ -310,6 +310,7 @@ List of Packages
|
||||
| underscore | Handy JavaScript utlities library. |
|
||||
| paypal-rest-sdk | PayPal API library. |
|
||||
| twilio | Twilio API library. |
|
||||
| clockwork | Clockwork SMS API library. |
|
||||
| validator | Used in conjunction with express-validator in **controllers/api.js**. |
|
||||
|
||||
|
||||
|
4
app.js
4
app.js
@ -11,6 +11,8 @@ var passport = require('passport');
|
||||
var expressValidator = require('express-validator');
|
||||
var connectAssets = require('connect-assets');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load controllers.
|
||||
*/
|
||||
@ -125,6 +127,8 @@ app.get('/api/steam', apiController.getSteam);
|
||||
app.get('/api/scraping', apiController.getScraping);
|
||||
app.get('/api/twilio', apiController.getTwilio);
|
||||
app.post('/api/twilio', apiController.postTwilio);
|
||||
app.get('/api/clockwork', apiController.getClockwork);
|
||||
app.post('/api/clockwork', apiController.postClockwork);
|
||||
app.get('/api/foursquare', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getFoursquare);
|
||||
app.get('/api/tumblr', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getTumblr);
|
||||
app.get('/api/facebook', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getFacebook);
|
||||
|
@ -15,6 +15,7 @@ var Twit = require('twit');
|
||||
var paypal = require('paypal-rest-sdk');
|
||||
var twilio = require('twilio')(secrets.twilio.sid, secrets.twilio.token);
|
||||
var Linkedin = require('node-linkedin')(secrets.linkedin.clientID, secrets.linkedin.clientSecret, secrets.linkedin.callbackURL);
|
||||
var clockwork = require('clockwork')({key: secrets.clockwork.apiKey});
|
||||
|
||||
/**
|
||||
* GET /api
|
||||
@ -413,6 +414,38 @@ exports.postTwilio = function(req, res, next) {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* GET /api/Clockwork
|
||||
* Clockwork SMS API example.
|
||||
*/
|
||||
|
||||
exports.getClockwork = function(req, res, next) {
|
||||
res.render('api/clockwork', {
|
||||
title: 'Clockwork SMS API'
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* POST /api/Clockwork
|
||||
* Clockwork SMS API example.
|
||||
* @param telephone
|
||||
*/
|
||||
|
||||
exports.postClockwork = function(req, res, next) {
|
||||
var message = {
|
||||
To: req.body.telephone,
|
||||
From: 'Hackathon',
|
||||
Content: 'Hello from the Hackathon Starter'
|
||||
};
|
||||
clockwork.sendSms(message, function(err, responseData) {
|
||||
if (err) return next(err.message);
|
||||
req.flash('success', { msg: 'Text sent to ' + responseData.responses[0].to});
|
||||
res.redirect('/api/clockwork');
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* GET /api/venmo
|
||||
* Venmo API example.
|
||||
|
@ -13,6 +13,7 @@
|
||||
"async": "~0.2.10",
|
||||
"bcrypt-nodejs": "~0.0.3",
|
||||
"cheerio": "~0.13.1",
|
||||
"clockwork": "~0.1.1",
|
||||
"connect-assets": "~3.0.0-beta1",
|
||||
"connect-mongo": "~0.4.0",
|
||||
"csso": "~1.3.11",
|
||||
|
26
views/api/clockwork.jade
Normal file
26
views/api/clockwork.jade
Normal file
@ -0,0 +1,26 @@
|
||||
extends ../layout
|
||||
|
||||
block content
|
||||
.page-header
|
||||
h2
|
||||
i.fa.fa-phone
|
||||
| Clockwork SMS API
|
||||
|
||||
.btn-group.btn-group-justified
|
||||
a.btn.btn-primary(href='http://github.com/mediaburst/node-clockwork', target='_blank')
|
||||
i.fa.fa-check-square-o
|
||||
| Clockwork Node
|
||||
a.btn.btn-primary(href='http://www.clockworksms.com/doc/clever-stuff/xml-interface/send-sms/', target='_blank')
|
||||
i.fa.fa-code-fork
|
||||
| XML API
|
||||
|
||||
h4 Send a text message
|
||||
.row
|
||||
.col-sm-6
|
||||
form(role='form', method='POST')
|
||||
input(type='hidden', name='_csrf', value=token)
|
||||
.form-group
|
||||
.input-group
|
||||
input.form-control(type='text', name='telephone', placeholder='Phone Number (international format)')
|
||||
span.input-group-btn
|
||||
button.btn.btn-success(type='submit') Send
|
@ -29,6 +29,8 @@ block content
|
||||
a(href='/api/steam') Steam
|
||||
li
|
||||
a(href='/api/twilio') Twilio
|
||||
li
|
||||
a(href='/api/clockwork') Clockwork SMS
|
||||
li
|
||||
a(href='/api/tumblr') Tumblr
|
||||
small ⇢ Login Required
|
||||
|
Reference in New Issue
Block a user