Sending a 50,000-SMS campaign from Laravel without blocking the app
Intro A shop owner on Up Review writes a text message, picks a segment and clicks "Send". The button answers right away, the dashboard stays usable, and when the last message has left, a notification says the campaign is sent. Behind that click, the biggest campaign so far went to about 50,000 phone numbers, and the average in 2026 is around 20,000. It did not start that way. Our first version…
Step 3: dispatch send jobs from the batch's finally() callback The CompileCampaignChunk jobs run inside a Bus::batch and are dispatched via the finally() callback. This ensures that the send jobs are only created after the compile step has completed successfully. By separating the compilation and sending stages, the pipeline avoids waiting for each individual SMS send, which would significantly slow down the application.
When the finally() callback executes, it dispatches a SendSmsBatchJob for each 500-message chunk, allowing the app to handle the workload more efficiently.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to