Preface by saying I'm totally new to this.
I "created" a basic account on amazon S3 to stand up a static website so that I could create the webhook. The basic idea is to take SMS sent to a phone number and forward those messages to an email address.
The code given to me by Twilio for the webhook is the following:
<?php
/**
* This section ensures that Twilio gets a response.
*/
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<Response></Response>'; //Place the desired response (if any) here
/**
* This section actually sends the email.
*/
/* Your email address */
$to = "your-email@example.com";
$subject = "Message from {$_REQUEST['From']} at {$_REQUEST['To']}";
$message = "You have received a message from {$_REQUEST['From']}. Body:
{$_REQUEST['Body']}";
$headers = "From: webmaster@example.com"; // Who should it come from?
mail($to, $subject, $message, $headers);
I added my email address between the quotes in the $to and $headers - "from lines. I then saved this file, which I made in text edit, into a .php and uploaded it to the S3 website. I made sure it was public.
I placed the automatically generated URL into the twilio "a message comes in" webhook field.
But it doesn't work. Any idea why? Is an S3 static website not the appropriate place for this, or am I uploading the file wrong?