private function respond($smsResponse, $reservation) { $response = new Twiml(); $response->message($smsResponse); if (!is_null($reservation)) { $response->message('Your reservation has been ' . $reservation->status . '.', ['to' => $reservation->respond_phone_number]); } return $response; }
private function _commandForSms($question) { $smsResponse = new Twiml(); $messageBody = $question->body . $this->_messageForSmsQuestion($question); $smsResponse->message($messageBody); return response($smsResponse)->withCookie('current_question', $question->id); }
/** * Manage the subscription for a subscriber. * * @param Request $request * * @return \Illuminate\Http\Response */ public function register(Request $request) { $phoneNumber = $request->input('From'); $message = $request->input('Body'); $outputMessage = $this->createMessage($phoneNumber, $message); $response = new Twiml(); $response->message($outputMessage); return response($response)->header('Content-Type', 'text/xml'); }
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Twiml; $response = new Twiml(); $response->message("The Robots are coming! Head for the hills!"); print $response;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once 'vendor/autoload.php'; // Loads the library use Twilio\Twiml; $response = new Twiml(); $message = $response->message(); $message->body("The Robots are coming! Head for the hills!"); $message->media("https://farm8.staticflickr.com/7090/6941316406_80b4d6d50e_z_d.jpg"); print $response;
<?php // Get the PHP helper library from twilio.com/docs/php/install require_once '/path/to/vendor/autoload.php'; // Loads the library use Twilio\Twiml; $response = new Twiml(); $body = $_REQUEST['Body']; if ($body == 'hello') { $response->message('Hi!'); } else { if ($body == 'bye') { $response->message('Goodbye'); } } print $response;
private function _smsMessageAfterLastQuestion() { $messageResponse = new Twiml(); $messageResponse->message("That was the last question.\n" . "Thank you for participating in this survey.\n" . 'Good bye.'); return response($messageResponse)->withCookie(Cookie::forget('survey_session'))->withCookie(Cookie::forget('current_question')); }