Skip to content

Instantly share code, notes, and snippets.

@stvnjacobs
Created March 31, 2015 00:41
Show Gist options
  • Save stvnjacobs/d4ab24168616a865f8fe to your computer and use it in GitHub Desktop.
Save stvnjacobs/d4ab24168616a865f8fe to your computer and use it in GitHub Desktop.
Express app is returning 403 errors unless twilio.webhook() has validate set to false
twilio-api on master
$ heroku run bash
Running `bash` attached to terminal... up, run.9605
Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
Recommending WEB_CONCURRENCY=1
~ $ echo $TWILIO_AUTH_TOKEN
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
~ $ node
> console.log(process.env.TWILIO_AUTH_TOKEN)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
undefined
var express = require('express');
var bodyParser = require('body-parser');
var twilio = require('twilio');
var app = express();
app.set('port', (process.env.PORT || 5000));
app.use(express.static(__dirname + '/public'));
app.use(bodyParser.urlencoded({ extended: true }));
app.get('/', function(request, response) {
response.send('Hello World!');
});
app.post('/sms', twilio.webhook({validate: false}), function(request, response) {
var twiml = new twilio.TwimlResponse();
twiml.message('Hello World!');
response.send(twiml);
});
app.listen(app.get('port'), function() {
console.log("Node app is running at localhost:" + app.get('port'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment