Simple code to receive SMS from Twilio

Good point – sbright33, is that the entirety of the agent code, or do I also need to configure the connection as in the following (it seems like I would, but this code is for posting, and I’m looking to receive only – so far):
`// Agent code
const TWILIO_ACCOUNT_SID = "your-twilio-account-goes-here"
const TWILIO_AUTH_TOKEN = "your-twilio-auth-token-goes-here"
const TWILIO_FROM_NUMBER = “+12015551212” // your phone no goes here
const TWILIO_TO_NUMBER = “+14085551212” // destination phone no

function send_sms(number, message) {
local twilio_url = format(“https://api.twilio.com/2010-04-01/Accounts/%s/SMS/Messages.json”, TWILIO_ACCOUNT_SID);
local auth = “Basic " + http.base64encode(TWILIO_ACCOUNT_SID+”:"+TWILIO_AUTH_TOKEN);
local body = http.urlencode({From=TWILIO_FROM_NUMBER, To=number, Body=message});
local req = http.post(twilio_url, {Authorization=auth}, body);
local res = req.sendsync();
if(res.statuscode != 201) {
server.log("error sending message: "+res.body);
}
}`