Skip to content

Instantly share code, notes, and snippets.

View kwhinnery's full-sized avatar

Kevin Whinnery kwhinnery

View GitHub Profile
doctype html
html(lang='en')
head
style.
input[type="text"] {
width: 200px;
display: block;
margin: 10px 0;
}
body
// require dependencies for the application
var twilio = require('twilio');
var express = require('express');
var bodyParser = require('body-parser');
// Create a simple Express web app that will parse incoming POST bodies
var app = express();
app.use(bodyParser.urlencoded({ extended: true }));
// Create a route to render the home page
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Message>
<Body>Trust pound!</Body>
<Media>http://i.imgur.com/Act0Q.gif</Media>
</Message>
</Response>
// Handle an incoming request from Twilio
app.post('/message', function(request, response) {
// create a TwiML response object. This object helps us generate an XML
// string that we will ultimately return as the result of this HTTP request
var twiml = new twilio.TwimlResponse();
// prepare the TwiML response
twiml.message(function() {
this.body('Trust Pound!');
this.media('http://i.imgur.com/Act0Q.gif');
[sudo] gem install twilio-ruby sinatra
touch app.rb
mkdir views
touch views/index.erb
# require app dependencies
require 'rubygems'
require 'sinatra'
require 'twilio-ruby'
# create a route to render the home page
get '/' do
erb :index
end
<!doctype html>
<html lang="en">
<head>
<style>
input[type="text"] {
width: 200px;
display: block;
margin: 10px 0;
}
</style>
# create a route that will respond to an incoming POST request from Twilio
post '/message' do
# Create a TwiML response object - this object helps us generate an XML string
# that we will return as the result of this request
twiml = Twilio::TwiML::Response.new do |r|
r.Message do |m|
m.Body 'Trust Pound!'
m.Media 'http://i.imgur.com/Act0Q.gif'
end
end
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.factory.MessageFactory;
import com.twilio.sdk.resource.instance.Message;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import java.util.ArrayList;
import java.util.List;