+ Start a Discussion
ClintLeeClintLee 

Is it Possible to Set HTTP Header Response From a Sites Page?

Hello All,

 

I have a question that I'm sure can be answered by the collective wisdom of the Salesforce community.

 

Background: 

I'm working on an application that utilizes Twilio to send SMS messages.  Sending outbound SMS messages is working fine.  If someone replies to one of these SMS messages Twilio will post an HTTP Request to a specified URL and it expects an HTTP response.  I set up a VF Sites page to act as a listener and execute the logic (i.e. attach the message to a custom object).  However, my dilemma is how can I control the HTTP response that my Sites page sends back?

 

Thanks in advance for your help,

 

Clint

 

http://www.clintslee.com

bob_buzzardbob_buzzard
You sites page returns a PageReference object as the responser.  You can control some of the headers using code similar to :

Apexpages.currentPage().getHeaders().put('Content-type', 'text/calendar');