Twilio API - doingfine/doingfine GitHub Wiki

When twilio receives an SMS addressed to the registered DoingFine phone number, it makes a GET request to /api/twilio. Twilio can receive a twiML (xml) response with instructions (ie an SMS resonse message or phone call script) to update on twilio: https://www.twilio.com/user/account/phone-numbers/PN87b2b73d36ba81ded076a9e203e357eb previous xml request url in alpha app (nelson's pre-HR ios version): http://www.doingfineapp.com/twilio/sms-response.xml

/* Available from Twilio via request.query:
query:
   { ToCountry: 'US',
     ToState: 'CA',
     SmsMessageSid: 'bunchofhex987234978234987',
     NumMedia: '0',
     ToCity: 'VENTURA',
     FromZip: '05666',
     SmsSid: 'bunchofhex987234978234987',
     FromState: 'VT',
     SmsStatus: 'received',
     FromCity: 'MONTPELIER',
     Body: 'Dff',
     FromCountry: 'US',
     To: '+15555555555',
     ToZip: '93001',
     MessageSid: 'SM717dcd406fd54735100db5800f810bb9',
     AccountSid: 'ACcc6bd88977d0eddd1ff935ecbc2cacee',
     From: '+15555555555',
     ApiVersion: '2010-04-01' }

*/
// Example: Respond to twilio request for TwiML 
exports.respond = function(req, res) {
  var senderPhone = req.query.From;
  var msg = req.query.Body;
  // form a twiML response (xml) like so:
  var twiml = new twilio.TwimlResponse();
  twiml.message('Hi, from DoingFine :)');
  res.set('Content-Type', 'text/xml');
  return res.send(200, twiml.toString());
}