Interpreting SMS Framework Codes

Last updated on
20 March 2025

The documentation herein is for the legacy/deprecated v1, v2, and v3 versions of SMS Framework.

Versions 4 and later have been re-architected. New documentation can be found in Communications Framework

Result Objects #

The following codes represent errors for result objects. You should not set an error on a result object unless the entire transaction failed.

A result object is an instance of \Drupal\sms\Message\SmsMessageResult, and can be set by $result->setError();. Its error codes can be found in \Drupal\sms\Message\SmsMessageResultStatus. See main article.

Account error #

Constant: \Drupal\sms\Message\SmsMessageResultStatus::ACCOUNT_ERROR

Generic account error used when there is a problem with the account. Such as the account needs to agree to new terms of service, account is frozen, etc. Unrelated to insufficient credits or account authentication details since they have their own codes.

Gateway flooded #

Constant: \Drupal\sms\Message\SmsMessageResultStatus::EXCESSIVE_REQUESTS

Used when the API server cannot handle requests at this time, or has received too many requests in a period of time.

If this code is used, the message may be rescheduled for sending.

No credit/funds #

Constant: \Drupal\sms\Message\SmsMessageResultStatus::NO_CREDIT

Used when the API account run out of credit or funds.

Use this if the entire transaction failed due to insufficient credit. If messages were partially transmitted then do not use this code. Use a report code on the messages that could not be sent.

Invalid sender #

Constant: \Drupal\sms\Message\SmsMessageResultStatus::INVALID_SENDER

Used when a sender phone number is required by the API, but the sender number added to the message objects were not provided or invalid.

Failed to Authenticate #

Constant: \Drupal\sms\Message\SmsMessageResultStatus::AUTHENTICATION

Such as when API, username, password, etc are invalid.

Invalid API parameters #

Constant: \Drupal\sms\Message\SmsMessageResultStatus::PARAMETERS

Used when the API is called in an invalid way. Usually because the API changed, something which can only be resolved by amending the gateway plugin code.

Generic Error (Other) #

Constant: \Drupal\sms\Message\SmsMessageResultStatus::ERROR

Use this error code when no other error codes accurately represent what went wrong.

Report Objects #

The following codes represent status codes for report objects. You must set a status code for each report object for it to be considered valid.

A result object is an instance of \Drupal\sms\Message\SmsDeliveryReport, and can be set by $report->setStatus();. Its codes can be found in \Drupal\sms\Message\SmsMessageReportStatus. See main article.

Queued #

Constant: \Drupal\sms\Message\SmsMessageReportStatus::QUEUED

Used when the gateway accepted the message to be sent.

Delivered #

Constant: \Drupal\sms\Message\SmsMessageReportStatus::DELIVERED

Used when the gateway confirmed the client device received the message. If unsure of whether the message was delivered, use QUEUED code.

Sometimes the API can update SMS Framework that the message was delivered by combining the message unique ID and the new status code. However this happens in a different request, not while send or incoming operations are executed.

Expired #

Constant: \Drupal\sms\Message\SmsMessageReportStatus::EXPIRED

Reports the message with the unique ID could not be delivered to the client, and expired while waiting in the gateway API queue.

The message will be discarded.

Rejected #

Constant: \Drupal\sms\Message\SmsMessageReportStatus::REJECTED

The message could not be delivered because there is a problem with the individual message. This problem must be unrelated to INVALID_RECIPIENT or CONTENT_INVALID codes.

The message will be discarded.

Invalid Recipient #

Constant: \Drupal\sms\Message\SmsMessageReportStatus::INVALID_RECIPIENT

Indicates the recipient phone number of the message is invalid.

The message will be discarded.

Content Invalid #

Constant: \Drupal\sms\Message\SmsMessageReportStatus::CONTENT_INVALID

Indicates the message contents are invalid. For example too long, or incorrect encoding.

The message will be discarded.

Generic Error (Other) #

Constant: \Drupal\sms\Message\SmsMessageReportStatus::ERROR

Use this code when no other codes accurately represent what went wrong.

The message will be discarded.

Help improve this page

Page status: No known problems

You can: