This file contains hidden or 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
from flask import Flask, request, make_response | |
from datetime import datetime, timedelta | |
from twilio import twiml | |
app = Flask(__name__) | |
@app.route("/sms") | |
def sms(): | |
#get the cookie value, or default to zero |
This file contains hidden or 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
twilioCapability = require('twilio.capability') | |
twilioCapability.initialize("[account_sid]","[auth_token]") | |
twilioCapability.allowClientIncoming( clientName ) | |
twilioCapability.allowClientOutgoing( twimlApp ) | |
return twilioCapability.generateToken(12000) |
This file contains hidden or 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
local response = http.request { | |
url = string.format( | |
'https://api.twilio.com/2010-04-01/Accounts/%s/SMS/Messages.json', | |
accountsid), | |
params = { To=to }, | |
auth = {accountsid, authtoken} | |
} |
This file contains hidden or 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
local twilio = require 'twilio' | |
local ACCOUNTSID = '[account_sid]' | |
local AUTHTOKEN = '[auth_token]' | |
local PHONENUMBER = '+14259678361' | |
twilio.call(ACCOUNTSID, AUTHTOKEN, | |
PHONENUMBER, | |
"+15555555555", | |
'http://twilio-demo.webscript.io/hello-monkey') |
This file contains hidden or 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
local twilio = require('twilio') | |
local ACCOUNTSID = '[account_sid]' | |
local AUTHTOKEN = '[auth_token]' | |
local PHONENUMBER = '+14259678361' | |
local response = twilio.sms(ACCOUNTSID, AUTHTOKEN, | |
PHONENUMBER, | |
'+15555555555', | |
'The Monkey Party is at 6PM. Bring Bananas!') |
This file contains hidden or 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
local twilio = require 'twilio' | |
local AUTHTOKEN = '[auth_token]' | |
if twilio.verify(request, AUTHTOKEN) then | |
return {['Content-Type']='application/xml'}, | |
[[<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n | |
<Response> | |
<Say>Hello, Monkey</Say> | |
</Response>]] |
This file contains hidden or 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
return {['Content-Type']='application/xml'}, string.Format( | |
[[<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n | |
<Response> | |
<Sms>%s, thanks for the message!</Sms> | |
</Response>]], name) |
This file contains hidden or 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
local from = (request.form or request.query).From; | |
local name; | |
if type(people[from]) then | |
name=people[from] | |
else | |
name = "Monkey"; | |
end |
This file contains hidden or 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
people = {}; | |
people["+14158675309"] = "Curious George"; | |
people["+14158675310"] = "Boots"; | |
people["+14158675311"] = "Virgil"; |
This file contains hidden or 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
return {['Content-Type']='application/xml'}, | |
[[<?xml version="1.0"?> | |
<Response> | |
<Sms>Hello, Mobile Monkey</Sms> | |
</Response>]] |