Skip to Content

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.

View Markdown (.md)

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

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

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

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

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)