Send SMS & Receive DLRs Using Spring Boot
Build a production-ready Spring Boot 3 service to dispatch transactional SMS and an HMAC-verified controller to ingest delivery reports.
Integrate SMS Pro into a modern Java 17+ and Spring Boot 3 enterprise application. This recipe builds a type-safe SmsProClient using RestClient and a secure @RestController that validates the X-SmsPro-Signature header before processing delivery receipts.
Spring Boot 3 SMS & DLR Integration
Click any step on the left to inspect the corresponding Java source code on the right.
1. Configure Application Properties
Store your gateway credentials in application.properties (or application.yml). Use your sk_test_... key for local development and inject sk_live_... secrets via environment variables in production.
Step 1 (typescript)
2. Define Immutable Java Records (DTOs)
Define clean, immutable Java records matching the SMS Pro REST request, response, and delivery report payload specifications.
Step 2 (typescript)
3. Build the SmsProClient Service
Use Spring Boot 3's modern RestClient to dispatch SMS. Every mutating request automatically attaches a unique Idempotency-Key (UUID v4) to prevent duplicate charges or accidental re-sends.
Step 3 (typescript)
4. Implement the Verified DLR Webhook Controller
Expose an HTTP POST endpoint at /api/v1/webhooks/smspro. Read X-SmsPro-Signature as t=<unix>,v1=<hex>, sign timestamp.rawBody, and compare equal-length digests.
Step 4 (typescript)
Idempotent Transactional SMS Dispatch
Configure a typed SMS Pro client, attach UUID idempotency keys, test against deterministic sandbox numbers, and parse RFC 7807 errors.
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.