PHP
Send a test request from Laravel.
Use Laravel’s HTTP client from a service class or queued job.
Connect your application
Configure the service
Define services.savara.host and services.savara.test_key in config/services.php using your server environment.
Dispatch from trusted server code
Call the example from a queued job after your transaction commits. Persist the job event ID so retries can reuse the idempotency key.
Handle the response
Laravel’s HTTP client exposes the HTTP status and parsed response. Store the message ID if the request succeeded.
use Illuminate\Support\Facades\Http;
function simulatePickup(string $orderId): array
{
$response = Http::withToken(config('services.savara.test_key'))
->withHeaders(['Idempotency-Key' => 'pickup-' . $orderId])
->timeout(10)
->post(config('services.savara.host') . '/api/v1/messages', [
'channel' => 'SMS',
'to' => '+256770123456',
'body' => 'Your order is ready to collect.',
'scenario' => 'delivered',
]);
return ['status' => $response->status(), 'result' => $response->json()];
}Before sending live
Use your own SavaraFlow deployment origin without a trailing slash and a scoped key from that deployment. Switch to a live key only after enabling the route and funding the workspace. Remove the sandbox scenario, use a recipient who agreed to receive the message, and include consent: true in the request. Keep API keys in server-side configuration.
Get a quote before your first live send.
Use the live quote endpoint to review the destination cost and available balance.