Reputation: 3015
I am trying to set up a route that I can let Twilio hit, that will return a response from Laravel.
But every Twilio request kicks back a 404 Http Response
.
Feels like I've got something misconfigured.
I have
SmSController
with a reply
method.routes/api.php
to hit the controller.$except
property in app/Http/Middleware/VerifyCsrfToken.php
Here's my app/Http/Controllers/SmsController.php
:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Twilio\Twiml;
class SmsController extends Controller
{
public function reply(Request $request) {
$response = new Twiml;
$response->message("Hello World!");
print $response;
}
}
And Here's my routes/api.php
:
Route::group([
'middleware' => 'auth:api'
], function () {
//
});
Route::post('sms/reply', 'SmsController@reply');
And inside the class VerifyCsrfToken
I have:
protected $except = [
'sms/reply'
];
Edit: I should mention, I have Twilio to hit the URL: https://www.MYWEBSITE.com/sms/reply
, which I think should correspond to the route I set up in api.pip
Upvotes: 1
Views: 152
Reputation: 3543
All the routes inside of api.php
are prefixed with api
inside a url, so your sms/reply
is actually api/sms/reply
, does this make sense?
Upvotes: 2