This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doctype html | |
html(lang='en') | |
head | |
style. | |
input[type="text"] { | |
width: 200px; | |
display: block; | |
margin: 10px 0; | |
} | |
body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<Response> | |
<Message> | |
<Body>Trust pound!</Body> | |
<Media>http://i.imgur.com/Act0Q.gif</Media> | |
</Message> | |
</Response> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[sudo] gem install twilio-ruby sinatra |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
touch app.rb | |
mkdir views | |
touch views/index.erb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# require app dependencies | |
require 'rubygems' | |
require 'sinatra' | |
require 'twilio-ruby' | |
# create a route to render the home page | |
get '/' do | |
erb :index | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<style> | |
input[type="text"] { | |
width: 200px; | |
display: block; | |
margin: 10px 0; | |
} | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |