Developers

  1. Home
  2. Docs
  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: http://mi.server.com/notifica.php?remitente=%p&tel=%P&estado=%d

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: http://mi.server.com/notifica.php?idenvio=123&remitente=%p&tel=%P&estado=%d

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\":\"http://mi.server.com/notifica.php?remitente=%p&tel=%P&estado=%d\"}" \ https://360sms.mexedia.com/Api/rest/message

Example of PHP request:

<?php
$post['to'] = array('34666555444'); $post['text'] = "text message"; $post['from'] = "msg";
$post
8
['dlr-url'] = "http://mi.server.com/notifica.php?idenvio=7584&remitente=%p&tel=%P&estado=%d"; $user ="miuser";
$password = 'mipass'; $ch = curl_init();
curl_setopt($ch, curl_setopt($ch, curl_setopt($ch, curl_setopt($ch, curl_setopt($ch, array(
CURLOPT_URL, "https://360sms.mexedia.com/Api/rest/message"); CURLOPT_RETURNTRANSFER, 1);
CURLOPT_POST, 1);
CURLOPT_POSTFIELDS, json_encode($post)); CURLOPT_HTTPHEADER,
"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.

Was this article helpful to you? No Yes

How can we help?