1. Home
  2. Documenti
  3. Developers
  4. Appendix A: Receipt notifications

Appendix A: Receipt notifications

If you want to receive the dlrs in real time you must specify the variable “dlr-url” with the URL of the client where you want the status of the sending to be notified.

The operation consists in specifying the URL where you want to make a request to our server for each http request when a notification from the operator is received. To do this the client must have an http server able to receive such notifications.

Our server will send the variables by the GET method as the client wants. To do that in the URL that you send us, you have to put the variable name followed by an escape character that will contain the value, the escape characters have the form of the “%” character followed by a letter. This would be a URL example:

These are the defined escape characters:

%i Identifier of SmsEasySms that was delivered when the sending was done. %d Value of the receipt notification.
%p The sender of the SMS.
%P The phone number of the SMS receiver.

%t Date of message sending in “YYYY-MM-DD HH: MM” format, eg, “1999-09-21 14:18”.
%c cost of message.
%s status (REJECTD, DELIVRD, EXPIRED, DELETED, UNDELIV, ACCEPTD, UNKNOWN, RECEIVED). %y dlr date of the message with “YYYY-MM-DD HH:MM” format, ex. “2020-09-21 14:19”.
%n part number (concatenated messages).
%j error code, e.g., 89 when the message is rejected due to insufficient balance.

The %d value will return the final state of sending to us, the possible values are:

1: Message is delivered to destination.
2: The message could not be delivered to the recipient.
4: The message was delivered to the SMSC, it is an intermediate notification, not an end result 16: It could not be delivered to the ending operator

To better explain the process, an example of how the sending of an sms and the receipt notification will happen is provided below.

Firstly, send the sms with the dlr-url variable to indicate the URL where you want to receive the sending notification. We will add this URL to our dispatch identifier to identify it clearly when we receive it. The final url for the notification would be:

Example of CURL request:

curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Basic bWl1c2VyOm1pcGFzcw==" \
-d "{\"to\":[\"34666555444\"],\"text\":\"message \",\"from\":\"msg\",\"dlr- url\":\"\"}" \

Example of PHP request:

$post['to'] = array('34666555444'); $post['text'] = "text message"; $post['from'] = "msg";
['dlr-url'] = ""; $user ="miuser";
$password = 'mipass'; $ch = curl_init();
curl_setopt($ch, curl_setopt($ch, curl_setopt($ch, curl_setopt($ch, curl_setopt($ch, array(
"Accept: application/json",
"Authorization: Basic ".base64_encode($user.":".$password))); $result = curl_exec ($ch);

Assuming that all messages could be delivered, three requests with the state = 1, sender = TEST, ID sending = 7584, and the matching phone number will be delivered to the notification.php script.

Hai trovato utile questo articolo? No

Come possiamo aiutarti?