Skip to main content

SMS Providers

The SmsProvider interface (jethro-sms/src/SmsProvider.php) is the seam. Everything above it works the same regardless of which gateway is being used.

Provider Interface​

See jethro-sms/src/SmsProvider.php for the full interface. Key points:

  • All methods return \Result — callers check isSuccess() / isFailure(). No exceptions for control flow.
  • send() returns \Result<SmsDeliveryBatch, string> — use sendSummary($batch->deliveries, $recipients) for a high-level AllSent / PartialSuccess / Failed tagged union.
  • cancel(SmsDeliveryBatch) returns the batch with per-delivery statuses updated; per-delivery gateway failures leave that delivery unchanged.

Capabilities are checked via hasCapability(SmsCapability). See jethro-sms/src/SmsCapability.php for the enum and each provider's hasCapability() method for which it supports.

Provider Comparison​

ProviderAuthFormatScheduleCancelStatus PollBalanceSender RegSender ID Reg
FiveCentSmsV5Providerkey-id + key-secret in JSON bodyJSON✓✓ (DELETE)✓ (GET /v5/sms/{id})✓✓✓
MobileMessageSmsProviderHTTP Basic (username + password)JSON✓✓ (DELETE)✓ (GET /v1/messages?message_id=)✓✓ (own number)✗ (dashboard/ACMA)
CellcastSmsProviderBearer token headerJSON✓✓ (POST cancel)✓ (GET /api/v2/report/message/{id})✓✓✓
FiveCentSmsV4Providerheader templateURL-encoded✗✗✗✓✗✗
TemplateSmsProviderconfigurableURL-encoded✗✗✗optional✗✗

FiveCentSmsV5Provider​

jethro-sms/src/Providers/FiveCentSmsV5Provider.php — key: '5centsmsv5', preference: 10. All 9 capabilities. Segment cost: 5000 millicents (5.0¢). Deferred send max delay: 365 days.

Test mode: "test": true in JSON body — real HTTP calls, API dry-runs.

CellcastSmsProvider​

jethro-sms/src/Providers/CellcastSmsProvider.php — key: 'cellcastv1', preference: 9. 7 capabilities (no GET_SENDER_IDS — uses SMS_SENDER_OPTIONS override). Segment cost: 4300 millicents (4.3¢). Deferred send max delay: 24 hours.

Sender number registration uses OTP verification. Sender ID registration submits to /api/v1/business/add.

Test mode: CellcastFakeHttpClient returns realistic JSON for all endpoints.

MobileMessageSmsProvider​

jethro-sms/src/Providers/MobileMessageSmsProvider.php — key: 'mobilemessagev1', preference: 10. Everything except REGISTER_SENDER_ID (alphanumeric IDs are registered through the MobileMessage dashboard, which submits to the ACMA Sender ID Register). Segment cost: 2000 millicents (2.0¢ nominal; real per-credit pricing arrives with each purchase and every send reports its credit cost). Deferred send max delay: null — the API documents only a 60-second minimum for scheduled_for and no maximum. send() clamps deferred sends up past that minimum so the undo cool-off survives (the API would otherwise silently downgrade sub-60-second schedules to immediate sends).

Auth is HTTP Basic (API username + password from the dashboard's Settings → API). Every 4xx/5xx uses a single {"error": "…"} envelope; sends reply per-message inside an HTTP 200 (results[].status is success | error | blocked), so a 200 is not "all delivered".

Test mode: MobileMessageFakeHttpClient fakes sends and cancels; reads (balance, senders, opt-outs) fall through to the real API.

FiveCentSmsV4Provider​

jethro-sms/src/Providers/FiveCentSmsV4Provider.php — key: '5centsmsv4', preference: -1 (excluded from help text). Extends TemplateSmsProvider with v4-specific defaults. Only supports GET_BALANCE. Deprecated.

TemplateSmsProvider​

jethro-sms/src/Providers/TemplateSmsProvider.php — key: null (the configured gateway's API is unknown), preference: -2 (excluded from auto-detection and help text). Generic URL-template-based provider. Serves as base class for FiveCentSmsV4Provider.

Decorators​

The provider chain is assembled from the inside out. See SMS Architecture in Jethro's developer docs (docs/docs/developer/sms/smsarchitecture.md) for the full chain order.

Auto-Detection​

When SMS_PROVIDER is unset or 'auto', auto-detection iterates providers by usagePreference() descending:

PreferenceProviderRequired constants
10FiveCentSmsV5ProviderSMS_5CENTSMS_APIKEY_ID, SMS_5CENTSMS_APIKEY
10MobileMessageSmsProviderSMS_MOBILEMESSAGE_APIKEY_USERNAME, SMS_MOBILEMESSAGE_APIKEY_PASSWORD
9CellcastSmsProviderSMS_CELLCAST_APIKEY
-1FiveCentSmsV4ProviderSMS_HTTP_URL (must match v4 endpoint)
-2TemplateSmsProviderSMS_HTTP_URL

SMS_PROVIDER short names (a company, not an API version): '5centsmsv5', 'cellcast', 'mobilemessage'. These differ from the "key" above, which is SmsProvider::getKey(): the upstream API and version recorded in smsdelivery.provider (see Database in Jethro's developer docs (docs/docs/developer/sms/database.mdx)). Providers with negative preference are excluded from the "not configured" error help text.

See Also​