Twilio and Picker: invalid response - content-type?

Hi all,

I am using Picker to process incoming text messages via Twilio. The goal is to alert me via Slack as soon as I receive one.

Everything works fine and I get a notification in Slack, but I receive daily emails from Twilio saying that there was a problem calling my webhook url, this is what Twilio receives from my server:

        <title>502 Bad Gateway</title>
        <h1>Bad Gateway</h1>An upstream server returned an invalid response.

This is my Picker route:

Picker.route '/api/new-sms', (params, req, res, next) ->
  message =
    to: params.query.To
    from: params.query.From
    body: params.query.Body
  booking = Bookings.findOne phone: message.from,
    sort: createdAt: -1
  EventEmitter.emit 'newIncomingSms', message, booking
  res.statusCode = 200

I tried to replicate this by using POSTMAN, but I always get a 200 OK. Could it be something with content-type? If so, how do you change that with Picker?

Thanks a lot!

I think I solved it:

  res.writeHead 200, 'Content-Type': 'text/html'
  return res.end 'ok'