Received messages logs
Find out how you can get logs for received messages.
Resource
https://api.infobip.com/sms/1/inbox/logs
Parameters
Property name | Type | Description |
---|---|---|
limit | int | Maximum number of messages in returned logs. Default value is 50. Maximum value is 1000. |
keyword | string | Keyword used in received messages. |
to | string | The message destination address. |
receivedSince | datetime | Lower limit on date and time of sending SMS. |
receivedUntil | datetime | Upper limit on date and time of sending SMS. |
Request Example
GET /sms/1/inbox/logs HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json
Response
{
"results":[
{
"messageId":"5908971644001839114",
"to":"41793026727",
"receivedAt":"2015-03-01T12:54:44.560+0000",
"from":"385998779111",
"text":"HEY hello world",
"cleanText":"hello world",
"keyword":"HEY",
"smsCount":1
},
{
"messageId":"5904932597450690569",
"to":"41793026727",
"receivedAt":"2015-03-01T12:54:42.231+0000",
"from":"385998779111",
"text":"HEY how are you",
"cleanText":"how are you",
"keyword":"HEY",
"smsCount":1
},
{
"messageId":"5904217701796992008",
"to":"41793026727",
"receivedAt":"2015-03-01T12:54:40.111+0000",
"from":"385998779111",
"text":"KEY hello world",
"cleanText":"hello world",
"keyword":"KEY",
"smsCount":1
}
]
}
Response format
If successful, the response header HTTP status code will be 200 OK
and the message logs will be returned.
If you try to send a message without authorization, you will get a response with HTTP status code 401 Unauthorized
.
MOLogsResponse
Parameter | Type | Description |
---|---|---|
results | MOLog | Collection of logs. |
MOLog
Parameter | Type | Description |
---|---|---|
messageId | String | The ID that uniquely identifies the received message. |
to | String | The message destination address. |
receivedAt | Date | Tells when the SMS was received. It has the following format: yyyy-MM-dd'T'HH:mm:ss.SSSZ . |
from | String | Sender ID that can be alphanumeric or numeric. |
text | String | Text of the message that was sent. |
cleanText | String | Text of the message that was sent without the keyword. |
keyword | String | Keyword extracted from the message text. |
smsCount | int | The number of sent message segments. |
Important:
Received messages logs are available for the last 48 hours!
Additional examples
Getting logs without any query parameter
Request:
GET /sms/1/inbox/logs HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json
GET /sms/1/inbox/logs HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/xml
curl -X GET \
-H 'Accept: application/json' \
-H 'Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' \
https://api.infobip.com/sms/1/inbox/logs
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://api.infobip.com/sms/1/inbox/logs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "",
CURLOPT_HTTPHEADER => array(
"accept: application/json",
"authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
require 'uri'
require 'net/http'
url = URI("https://api.infobip.com/sms/1/inbox/logs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.infobip.com")
headers = {
'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
'accept': "application/json"
}
conn.request("GET", "/sms/1/inbox/logs", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse<String> response = Unirest.get("https://api.infobip.com/sms/1/inbox/logs")
.header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
.header("accept", "application/json")
.asString();
var client = new RestClient("https://api.infobip.com/sms/1/inbox/logs");
var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
IRestResponse response = client.Execute(request);
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.infobip.com/sms/1/inbox/logs");
xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
xhr.setRequestHeader("accept", "application/json");
xhr.send(data);
Response:
{
"results":[
{
"messageId":"5908971644001839114",
"to":"41793026727",
"receivedAt":"2015-03-01T12:54:44.560+0000",
"from":"385998779111",
"text":"HEY hello world",
"cleanText":"hello world",
"keyword":"HEY",
"smsCount":1
},
{
"messageId":"5904932597450690569",
"to":"41793026727",
"receivedAt":"2015-03-01T12:54:42.231+0000",
"from":"385998779111",
"text":"HEY how are you",
"cleanText":"how are you",
"keyword":"HEY",
"smsCount":1
},
{
"messageId":"5904217701796992008",
"to":"41793026727",
"receivedAt":"2015-03-01T12:54:40.111+0000",
"from":"385998779111",
"text":"KEY hello world",
"cleanText":"hello world",
"keyword":"KEY",
"smsCount":1
}
]
}
HTTP/1.1 200 OK
Content-Type: application/xml
<moLogsResponse>
<results>
<result>
<messageId>5908971644001839114</messageId>
<to>13372</to>
<receivedAt>2015-03-01T12:54:44.560+0000</receivedAt>
<from>385998779613</from>
<text>HEY hello world</text>
<cleanText>hello world</cleanText>
<keyword>HEY</keyword>
<smsCount>1</smsCount>
</result>
<result>
<messageId>5904932597450690569</messageId>
<to>13372</to>
<receivedAt>2015-03-01T12:54:42.231+0000</receivedAt>
<from>385998779613</from>
<text>HEY how are you</text>
<cleanText>how are you</cleanText>
<keyword>HEY</keyword>
<smsCount>1</smsCount>
</result>
<result>
<messageId>5904217701796992008</messageId>
<to>13372</to>
<receivedAt>2015-03-01T12:54:40.111+0000</receivedAt>
<from>385998779613</from>
<text>KEY hello world</text>
<cleanText>hello world</cleanText>
<keyword>KEY</keyword>
<smsCount>1</smsCount>
</result>
</results>
</moLogsResponse>
Getting logs with keyword
and to
as filters
Request:
GET /sms/1/inbox/logs?keyword=HEY&to=13372 HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json
GET /sms/1/inbox/logs?keyword=HEY&to=13372 HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/xml
curl -X GET
-H 'Accept: application/json'
-H 'Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
https://api.infobip.com/sms/1/inbox/logs?keyword=HEY&to=13372
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://api.infobip.com/sms/1/inbox/logs?keyword=HEY&to=13372",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "",
CURLOPT_HTTPHEADER => array(
"accept: application/json",
"authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
require 'uri'
require 'net/http'
url = URI("https://api.infobip.com/sms/1/inbox/logs?keyword=HEY&to=13372")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.infobip.com")
headers = {
'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
'accept': "application/json"
}
conn.request("GET", "/sms/1/inbox/logs?keyword=HEY&to=13372", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse<String> response = Unirest.get("https://api.infobip.com/sms/1/inbox/logs?keyword=HEY&to=13372")
.header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
.header("accept", "application/json")
.asString();
var client = new RestClient("https://api.infobip.com/sms/1/inbox/logs?keyword=HEY&to=13372");
var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
IRestResponse response = client.Execute(request);
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.infobip.com/sms/1/inbox/logs?keyword=HEY&to=13372");
xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
xhr.setRequestHeader("accept", "application/json");
xhr.send(data);
Response:
{
"results":[
{
"messageId":"5908971644001839114",
"to":"41793026727",
"receivedAt":"2015-03-01T12:54:44.560+0000",
"from":"385998779111",
"text":"HEY hello world",
"cleanText":"hello world",
"keyword":"HEY",
"smsCount":1
},
{
"messageId":"5904932597450690569",
"to":"41793026727",
"receivedAt":"2015-03-01T12:54:42.231+0000",
"from":"385998779111",
"text":"HEY how are you",
"cleanText":"how are you",
"keyword":"HEY",
"smsCount":1
}
]
}
HTTP/1.1 200 OK
Content-Type: application/xml
<moLogsResponse>
<results>
<result>
<messageId>5908971644001839114</messageId>
<to>13372</to>
<receivedAt>2015-03-01T12:54:44.560+0000</receivedAt>
<from>385998779613</from>
<text>HEY hello world</text>
<cleanText>hello world</cleanText>
<keyword>HEY</keyword>
<smsCount>1</smsCount>
</result>
<result>
<messageId>5904932597450690569</messageId>
<to>13372</to>
<receivedAt>2015-03-01T12:54:42.231+0000</receivedAt>
<from>385998779613</from>
<text>HEY how are you</text>
<cleanText>how are you</cleanText>
<keyword>HEY</keyword>
<smsCount>1</smsCount>
</result>
</results>
</moLogsResponse>
Getting messages without a keyword
To get all messages sent without the keyword, you can use the NO_KEYWORD
filter.
Request:
GET /sms/1/inbox/logs?keyword=NO_KEYWORD HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json
GET /sms/1/inbox/logs?keyword=NO_KEYWORD HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/xml
curl -X GET
-H 'Accept: application/json'
-H 'Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
https://api.infobip.com/sms/1/inbox/logs?keyword=NO_KEYWORD
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://api.infobip.com/sms/1/inbox/logs?keyword=NO_KEYWORD",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "",
CURLOPT_HTTPHEADER => array(
"accept: application/json",
"authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
require 'uri'
require 'net/http'
url = URI("https://api.infobip.com/sms/1/inbox/logs?keyword=NO_KEYWORD")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
request["accept"] = 'application/json'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.infobip.com")
headers = {
'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
'accept': "application/json"
}
conn.request("GET", "/sms/1/inbox/logs?keyword=NO_KEYWORD", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse<String> response = Unirest.get("https://api.infobip.com/sms/1/inbox/logs?keyword=NO_KEYWORD")
.header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
.header("accept", "application/json")
.asString();
var client = new RestClient("https://api.infobip.com/sms/1/inbox/logs?keyword=NO_KEYWORD");
var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
IRestResponse response = client.Execute(request);
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.infobip.com/sms/1/inbox/logs?keyword=NO_KEYWORD");
xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
xhr.setRequestHeader("accept", "application/json");
xhr.send(data);
Response:
{
"results":[
{
"messageId":"606386740726357762",
"from":"385998779111",
"to":"41793026727",
"text":"Message without keyword",
"cleanText":"Message without keyword",
"receivedAt":"2015-05-20T10:06:46.880+0000",
"smsCount":1
},
{
"messageId":"3634590217319761028",
"from":"385998779111",
"to":"41793026727",
"text":"Logs test",
"cleanText":"Logs test",
"receivedAt":"2015-05-20T10:06:17.713+0000",
"smsCount":1
}
]
}
HTTP/1.1 200 OK
Content-Type: application/xml
<moLogsResponse>
<results>
<result>
<messageId>606386740726357762</messageId>
<from>385998779111</from>
<to>41793026727</to>
<text>Message without keyword</text>
<cleanText>Message without keyword</cleanText>
<receivedAt>2015-05-20T10:06:46.880+0000</receivedAt>
<smsCount>1</smsCount>
</result>
<result>
<messageId>3634590217319761028</messageId>
<from>385998779111</from>
<to>41793026727</to>
<text>Logs test</text>
<cleanText>Logs test</cleanText>
<receivedAt>2015-05-20T10:06:17.713+0000</receivedAt>
<smsCount>1</smsCount>
</result>
</results>
</moLogsResponse>
Getting messages received within a specified time span
You can use receivedSince
and/or receivedUntil
to filter messages according to the receivedAt
property.
Request:
GET /sms/1/inbox/logs?receivedSince=2015-05-20T10:06:16.713%2b00:00&receivedUntil=2015-05-20T10:06:47.880%2b00:00 HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json
Response:
{
"results":[
{
"messageId":"606386740726357762",
"from":"385998779111",
"to":"41793026727",
"text":"Message without keyword",
"cleanText":"Message without keyword",
"receivedAt":"2015-05-20T10:06:46.880+0000",
"smsCount":1
},
{
"messageId":"3634590217319761028",
"from":"385998779111",
"to":"41793026727",
"text":"Logs test",
"cleanText":"Logs test",
"receivedAt":"2015-05-20T10:06:17.713+0000",
"smsCount":1
}
]
}