Created
October 2, 2013 18:15
-
-
Save caseysoftware/6798091 to your computer and use it in GitHub Desktop.
Wiring the first version to generate a text message whenever you receive an email
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| include 'credentials.php'; | |
| require 'vendor/Services/Twilio.php'; | |
| $json = file_get_contents('php://input'); | |
| $data = json_decode($json); | |
| //use the from/subject from the webhook call to create text message | |
| $sms_body = $data->message_data->addresses->from->name; | |
| $sms_body .= " just emailed: \n"; | |
| $sms_body .= $data->message_data->subject; | |
| //send the text message | |
| $client = new Services_Twilio($AccountSid, $AuthToken); | |
| $message = $client->account->messages->sendMessage( | |
| $fromNumber, // From a Twilio number in your account | |
| $toNumber, // Text any number | |
| $sms_body | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment