Skip to Content

Send SMS & Handle Webhooks Using Laravel

Integrate SMS Pro into a Laravel 10/11 application with a custom Notification Channel, Http client wrapper, and signed webhook route.

View Markdown (.md)

Integrate SMS Pro into a Laravel 10 or 11 application. This recipe builds a dedicated SmsProService using Laravel's Illuminate\Support\Facades\Http client, provisions a custom Notification Channel, and configures a signed webhook endpoint for carrier delivery reports.

Laravel 10/11 SMS Pro Integration

Navigate the steps on the left to inspect the corresponding PHP code on the right.

1

1. Configure Environment & Services Config

Add your API credentials to .env and register the smspro service entry in config/services.php.

Step 1 (typescript)
2

2. Build the SmsProService Client

Create a reusable service class using Laravel's Http facade. Every mutating POST request attaches a unique Str::uuid() idempotency header and throws on HTTP 4xx/5xx client or billing errors.

Step 2 (typescript)
3

3. Create a Custom Notification Channel

Implement SmsProChannel so any standard Laravel Notification (User::notify()) can dispatch SMS seamlessly through SMS Pro.

Step 3 (typescript)
4

4. Build the Signed Webhook Controller

Create an invokable controller in app/Http/Controllers/SmsProWebhookController.php that verifies X-SmsPro-Signature using hash_equals() against the raw request content ($request->getContent()).

Step 4 (typescript)