#1 Bulk SMS Developer API Service Provider India

Bulk SMS API

We are leading Bulk SMS provider in India offering best business deals on API Codes.

This technical document is intended for API developers who wish to use the SMSGATEWAYHUB TECHNOLOGIES PVT. LTD. HTTP API for sending messages, receiving delivery reports and checking account balances.

The document describes the various programming models and commands used by developers when using this API.

The HTTP API could be used for both low and high end messaging services. HTTP is a means for relaying information; the HTTP API can be used with practically any web service application. This is particularly useful for high volume message sending. The HTTP API offers various methods of sending and receiving SMS messages. The document contains specifications for the following methods.

Send messages using HTTP GET.

Receive responses using HTTP GET.

Functions : Send SMS, Group SMS, Flash SMS, Unicode SMS, Balance Check, Delivery Reports and Time Scheduling.

Host: 103.241.136.229
Port: 3456
Protocol: SMPP Protocol

Single SMS API

https://www.smsgatewayhub.com/ is a decade old firm in the business

TEXT Format

https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx&text=test message&route=1

Response : {"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047","MessageData":[{"Number":"91989xxxxxxx","MessageId":"BqTiw66A2UGLFV3DnwHFLQ"}]}

OTP SMS Format

https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=OTP&DCS=0&flashsms=0&number=91989xxxxxxx&text=test message&route=1

Response : {"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047","MessageData":[{"Number":"91989xxxxxxx","MessageId":"BqTiw66A2UGLFV3DnwHFLQ"}]}

UNICODE Format

https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=8&flashsms=0&number=91989xxxxxxx&text=परीक्षण सन्देश&route=1

Response : {"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047","MessageData":[{"Number":"91989xxxxxxx","MessageId":"BqTiw66A2UGLFV3DnwHFLQ"}]}

GROUP SMS Format

https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx&text=test message&groupid=###&route=1

Response : {"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047","MessageData":[{"Number":"91989xxxxxxx","MessageId":"BqTiw66A2UGLFV3DnwHFLQ"}]}

FLASH Format

https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=0&flashsms=1&number=91989xxxxxxx&text=test message&route=1

Response : {"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047","MessageData":[{"Number":"91989xxxxxxx","MessageId":"BqTiw66A2UGLFV3DnwHFLQ"}]}

SCHEDULE SMS Format

https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx&text=test message&schedtime=2015/12/31 22:35:00 PM&route=1

Response : {"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047","MessageData":[{"Number":"91989xxxxxxx","MessageId":"BqTiw66A2UGLFV3DnwHFLQ"}]}

Query Params

White Right

APIKey

Value (yourapicode)

White Right

senderid

Value (yoursenderid)

White Right

channel

Value (yourchannel)

White Right

DCS

Value (your data coding value).

White Right

flashsms

Value (your flash sms value)

White Right

number

Value (Recipient mobile number)

White Right

text

Value (Your sms content)

White Right

route

Value (your route id)

White Right

schedtime

Value (your schedule date/time)

White Right

groupid

Value (your group id for numbers)

Parameter Type Description
APIKey string Instead of the username and password you can use the API KEYfor authentication of account.
senderid string Approved sender id(6 characters string only).
channel string Message channel Promotional=1 or Transactional=2 and OTP=OTP.
DCS string Data coding value (Default is 0 for normal message, Set 8 for unicode sms).
flashsms string Flash message immediate display (Default is 0 for normal sms, Set 1 for immediate display).
number string Recipient mobile number (pass with comma[,] seprated if need to send on more then one number).
text text Your sms content.
route string Pass the route id in this parameter to route the message. Click Here for more information regarding your routeid.
schedtime string Schedule date and time for scheduling message (DateTime formate will be 2014/10/06 20:30:00 PM yyyy/mm/dd hh:mm:ss PM).
groupid string group id for numbers.

SMSGATEWAYHUB is a decade old firm in the business of online bulk SMS services, catering to all types of customers, big, medium and small sized organizations through our innovative solutions for sending group text messages all over India through different sms gateway networks.

Bulk SMS API

https://www.smsgatewayhub.com/ is a decade old firm in the business

TEXT Format

https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx,91999xxxxxxx&text=test message&route=1

Response : {"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047","MessageData":[{"Number":"91989xxxxxxx","MessageId":"mvHdpSyS7UOs9hjxixQLvw"},{"Number":"91999xxxxxxx","MessageId":"PfivClgH20iG6G5R3usHwA"}]}

OTP SMS Format

https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=OTP&DCS=0&flashsms=0&number=91989xxxxxxx,91999xxxxxxx&text=test message&route=1

Response : {"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047","MessageData":[{"Number":"91989xxxxxxx","MessageId":"mvHdpSyS7UOs9hjxixQLvw"},{"Number":"91999xxxxxxx","MessageId":"PfivClgH20iG6G5R3usHwA"}]}

UNICODE Format

https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=8&flashsms=0&number=91989xxxxxxx,91999xxxxxxx&text=परीक्षण सन्देश&route=1

Response : {"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047","MessageData":[{"Number":"91989xxxxxxx","MessageId":"mvHdpSyS7UOs9hjxixQLvw"},{"Number":"91999xxxxxxx","MessageId":"PfivClgH20iG6G5R3usHwA"}]}

GROUP SMS Format

https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx,91989xxxxxxx&text=test message&groupid=###,###&route=1

Response : {"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047","MessageData":[{"Number":"91989xxxxxxx","MessageId":"mvHdpSyS7UOs9hjxixQLvw"},{"Number":"91999xxxxxxx","MessageId":"PfivClgH20iG6G5R3usHwA"}]}

FLASH Format

https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=0&flashsms=1&number=91989xxxxxxx,91999xxxxxxx&text=test message&route=1

Response : {"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047","MessageData":[{"Number":"91989xxxxxxx","MessageId":"mvHdpSyS7UOs9hjxixQLvw"},{"Number":"91999xxxxxxx","MessageId":"PfivClgH20iG6G5R3usHwA"}]}

SCHEDULE SMS Format

https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx,91999xxxxxxx&text=test message&schedtime=2015/12/31 22:35:00 PM&route=1

Response : {"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047","MessageData":[{"Number":"91989xxxxxxx","MessageId":"mvHdpSyS7UOs9hjxixQLvw"},{"Number":"91999xxxxxxx","MessageId":"PfivClgH20iG6G5R3usHwA"}]}

Query Params

White Right

APIKey

Value (yourapicode)

White Right

senderid

Value (yoursenderid)

White Right

channel

Value (yourchannel)

White Right

DCS

Value (your data coding value).

White Right

flashsms

Value (your flash sms value)

White Right

number

Value (Recipient mobile number)

White Right

text

Value (Your sms content)

White Right

route

Value (your route id)

White Right

schedtime

Value (your schedule date/time)

White Right

groupid

Value (your group id for numbers)

Parameter Type Description
APIKey string Instead of the username and password you can use the API KEYfor authentication of account.
senderid string Approved sender id(6 characters string only).
channel string Message channel Promotional=1 or Transactional=2 and OTP=OTP.
DCS string Data coding value (Default is 0 for normal message, Set 8 for unicode sms).
flashsms string Flash message immediate display (Default is 0 for normal sms, Set 1 for immediate display).
number string Recipient mobile number (pass with comma[,] seprated if need to send on more then one number).
text text Your sms content.
route string Pass the route id in this parameter to route the message. Click Here for more information regarding your routeid.
schedtime string Schedule date and time for scheduling message (DateTime formate will be 2014/10/06 20:30:00 PM yyyy/mm/dd hh:mm:ss PM).
groupid string group id for numbers.

SMSGATEWAYHUB is a decade old firm in the business of online bulk SMS services, catering to all types of customers, big, medium and small sized organizations through our innovative solutions for sending group text messages all over India through different sms gateway networks.

International SMS API

https://www.smsgatewayhub.com/ is a decade old firm in the business

TEXT Format

https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=INT&DCS=0&flashsms=0&number=12093158246&text=test message&route=1

Response : {"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047","MessageData":[{"Number":"12093158246","MessageId":"mvHdpSyS7UOs9hjxixQLvw"},{"Number":"12093158246","MessageId":"PfivClgH20iG6G5R3usHwA"}]}

UNICODE Format

https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=INT&DCS=8&flashsms=0&number=12093158246&text=परीक्षण सन्देश&route=1

Response : {"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047","MessageData":[{"Number":"12093158246","MessageId":"mvHdpSyS7UOs9hjxixQLvw"},{"Number":"12093158246","MessageId":"PfivClgH20iG6G5R3usHwA"}]}

GROUP SMS Format

https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=INT&DCS=0&flashsms=0&number=12093158246&text=test message&groupid=###,###&route=1

Response : {"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047","MessageData":[{"Number":"12093158246","MessageId":"mvHdpSyS7UOs9hjxixQLvw"},{"Number":"12093158246","MessageId":"PfivClgH20iG6G5R3usHwA"}]}

FLASH Format

https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=INT&DCS=0&flashsms=1&number=12093158246&text=test message&route=1

Response : {"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047","MessageData":[{"Number":"12093158246","MessageId":"mvHdpSyS7UOs9hjxixQLvw"},{"Number":"12093158246","MessageId":"PfivClgH20iG6G5R3usHwA"}]}

SCHEDULE SMS Format

https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=INT&DCS=0&flashsms=0&number=12093158246&text=test message&schedtime=2015/12/31 22:35:00 PM&route=1

Response : {"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047","MessageData":[{"Number":"12093158246","MessageId":"mvHdpSyS7UOs9hjxixQLvw"},{"Number":"12093158246","MessageId":"PfivClgH20iG6G5R3usHwA"}]}

Query Params

White Right

APIKey

Value (yourapicode)

White Right

senderid

Value (yoursenderid)

White Right

channel

Value (yourchannel)

White Right

DCS

Value (your data coding value).

White Right

flashsms

Value (your flash sms value)

White Right

number

Value (Recipient mobile number)

White Right

text

Value (Your sms content)

White Right

route

Value (your route id)

White Right

schedtime

Value (your schedule date/time)

White Right

groupid

Value (your group id for numbers)

Parameter Type Description
APIKey string Instead of the username and password you can use the API KEYfor authentication of account.
senderid string Approved sender id(6 characters string only).
channel string Message channel Promotional=1, Transactional=2, OTP=OTP and INT=INT.
DCS string Data coding value (Default is 0 for normal message, Set 8 for unicode sms).
flashsms string Flash message immediate display (Default is 0 for normal sms, Set 1 for immediate display).
number string Recipient mobile number (pass with comma seprated if need to send on more then one number) must required country code without +
text text Your sms content.
route string Pass the route id in this parameter to route the message. Click Here for more information regarding your routeid.
schedtime string Schedule date and time for scheduling message (DateTime formate will be 2014/10/06 20:30:00 PM yyyy/mm/dd hh:mm:ss PM).
groupid string group id for numbers.

SMSGATEWAYHUB is a decade old firm in the business of online bulk SMS services, catering to all types of customers, big, medium and small sized organizations through our innovative solutions for sending group text messages all over India through different sms gateway networks.

Balance Check

https://www.smsgatewayhub.com/ is a decade old firm in the business

CHECK AVAILABLE BALANCE

https://www.smsgatewayhub.com/api/mt/GetBalance?APIKey=yourapicode

Response : {"ErrorCode":"0","ErrorMessage":"Success","Balance":"Promo:9988|Trans:0"}

Query Params

White Right

APIKey

Value (yourapicode)

Parameter Type Description
APIKey string Instead of the username and password you can use the API KEYfor authentication of account.

SMSGATEWAYHUB is a decade old firm in the business of online bulk SMS services, catering to all types of customers, big, medium and small sized organizations through our innovative solutions for sending group text messages all over India through different sms gateway networks.

DLR Status

https://www.smsgatewayhub.com/ is a decade old firm in the business

DELIVERY CHECK STATUS

https://www.smsgatewayhub.com/api/mt/GetDelivery?APIKey=yourapicode&jobid=#######

Response : {"ErrorCode":"0","ErrorMessage":"Success","MessageId":null,"DeliveryReports":[{"MessageId":"mvHdpSyS7UOs9hjxixQLvw","DeliveryStatus":"Delivered","DeliveryDate":"2015-09-28T06:17:00"},{"MessageId":"PfivClgH20iG6G5R3usHwA","DeliveryStatus":"Delivered","DeliveryDate":"2015-09-28T06:17:00"}]}

Query Params

White Right

APIKey

Value (yourapicode)

White Right

jobid

Value (yourjobid)

Parameter Type Description
APIKey string Instead of the username and password you can use the API KEYfor authentication of account.
Jobid string You can use the Job Id check the message status.

SMSGATEWAYHUB is a decade old firm in the business of online bulk SMS services, catering to all types of customers, big, medium and small sized organizations through our innovative solutions for sending group text messages all over India through different sms gateway networks.

Status/Error Codes

Error Code Description
000 Success
001 login details cannot be blank
003 sender cannot be blank
004 message text cannot be blank
005 message data cannot be blank
006 error: generic error description
007 username or password is invalid
008 account not active
009 account locked, contact your account manager
010 api restriction
011 ip address restriction
012 invalid length of message text
013 mobile numbers not valid
014 account locked due to spam message contact support
015 senderid not valid
017 groupid not valid
018 multi message to group is not supported
019 schedule date is not valid
020 message or mobile number cannot be blank
021 insufficient credits
022 invalid jobid
023 parameter missing
024 invalid template or template mismatch
025 {Field} can not be blank or empty
026 invalid date range
027 invalid optin user

Embedding Codes

Character UTF-8
- %2D
! %21
" %22
# %23
$ %24
% %25
& %26
> %3E
< %3C
  %7F
  %C2%A0
' %27
( %28
) %29
* %2A
+ %2B
, %2C
. %2E
/ %2F
0 %30
1 %31
2 %32
3 %33
4 %34
5 %35
6 %36
7 %37
8 %38
9 %39
: %3A
; %3B
= %3D
? %3F
@ %40
[ %5B
\ %5C
] %5D
^ %5E
_ %5F
` %60
` %E2%82%AC
A %41
a %61
B %42
b %62
C %43
c %63
D %44
d %64
E %45
e %65
F %46
f %66
G %47
g %67
H %48
h %68
I %49
i %69
J %4A
j %6A
K %4B
k %6B
L %4C
l %6C
M %4D
m %6D
N %4E
n %6E
O %4F
o %6F
P %50
p %70
Q %51
q %71
R %52
r %72
S %53
s %73
space %20
T %54
t %74
U %55
u %75
V %56
v %76
W %57
w %77
X %58
x %78
Y %59
y %79
Z %5A
z %7A
{ %7B
| %7C
} %7D
~ %7E
 %81
 %C5%8D
 %8F
 %C2%90
 %9D
¡ %C2%A1
¢ %C2%A2
£ %C2%A3
¤ %C2%A4
¥ %C2%A5
¦ %C2%A6
§ %C2%A7
¨ %C2%A8
© %C2%A9
ª %C2%AA
« %C2%AB
¬ %C2%AC
­ %C2%AD
® %C2%AE
¯ %C2%AF
° %C2%B0
± %C2%B1
² %C2%B2
³ %C2%B3
´ %C2%B4
µ %C2%B5
%C2%B6
· %C2%B7
¸ %C2%B8
¹ %C2%B9
º %C2%BA
» %C2%BB
¼ %C2%BC
½ %C2%BD
¾ %C2%BE
¿ %C2%BF
× %C3%97
ß %C3%9F
À %C3%80
à %C3%A0
Á %C3%81
á %C3%A1
 %C3%82
â %C3%A2
à %C3%83
ã %C3%A3
Ä %C3%84
ä %C3%A4
Å %C3%85
å %C3%A5
Æ %C3%86
æ %C3%A6
Ç %C3%87
ç %C3%A7
È %C3%88
è %C3%A8
É %C3%89
é %C3%A9
Ê %C3%8A
ê %C3%AA
Ë %C3%8B
ë %C3%AB
Ì %C3%8C
ì %C3%AC
Í %C3%8D
í %C3%AD
Î %C3%8E
î %C3%AE
Ï %C3%8F
ï %C3%AF
Ð %C3%90
ð %C3%B0
Ñ %C3%91
ñ %C3%B1
Ò %C3%92
ò %C3%B2
Ó %C3%93
ó %C3%B3
Ô %C3%94
ô %C3%B4
Õ %C3%95
õ %C3%B5
Ö %C3%96
ö %C3%B6
÷ %C3%B7
Ø %C3%98
ø %C3%B8
Ù %C3%99
ù %C3%B9
Ú %C3%9A
ú %C3%BA
Û %C3%9B
û %C3%BB
Ü %C3%9C
ü %C3%BC
Ý %C3%9D
ý %C3%BD
Þ %C3%9E
þ %C3%BE
Ÿ %C5%B8
ÿ %C3%BF
Π%C5%92
œ %C5%93
Š %C5%A0
š %C5%A1
Ž %C5%BD
ž %C5%BE
ƒ %C6%92
ˆ %CB%86
˜ %CB%9C
%E2%80%93
%E2%80%94
' %E2%80%98
' %E2%80%99
%E2%80%9A
" %E2%80%9C
" %E2%80%9D
" %E2%80%9E
%E2%80%A0
%E2%80%A1
%E2%80%A2
%E2%80%A6
%E2%80%B0
%E2%80%B9
%E2%80
%E2%84

Download Docs

Post Method

URL : https://www.smsgatewayhub.com/RestAPI/MT.svc/mt

Single Message

<SmsQueue><Account><User>abc</User><Password>123</Password><SenderId>TESTIN</SenderId><Channel>1</Channel><DCS>0</DCS><FlashSms>0</FlashSms><Route>1</Route></Account><Messages><Message><Number>9198981XXXXX</Number><Text>Messge from xml</Text></Message></Messages></SmsQueue>

Multiple Message

<SmsQueue><Account><User>abc</User><Password>123</Password><SenderId>TESTIN</SenderId><Channel>1</Channel><DCS>0</DCS><FlashSms>0</FlashSms><Route>1</Route></Account><Messages><Message><Number>9198981XXXXX</Number><Text>Messge from xml</Text></Message><Message><Number>9198981XXXXX</Number><Text>Messge from xml</Text></Message></Messages></SmsQueue>

Response : <SmsResponse><ErrorCode>000</ErrorCode><ErrorMessage>Success</ErrorMessage><JobId>2463227</JobId><MessageData><Messages><Number>919898xxxxxx</Number><MessageId>Jb7qIygj2kGp63Q0ZE0rjw</MessageId></Messages></MessageData></SmsResponse>

Query Params

White Right

User

Value (yourusername)

White Right

Password

Value (yourpassword)

White Right

senderid

Value (yoursenderid)

White Right

channel

Value (yourchannel)

White Right

DCS

Value (your data coding value).

White Right

flashsms

Value (your flash sms value)

White Right

number

Value (Recipient mobile number)

White Right

text

Value (Your sms content)

White Right

route

Value (your route id)

White Right

schedtime

Value (your schedule date/time)

White Right

groupid

Value (your group id for numbers)

Parameter Type Description
User string Your system login name
Password string Your system password
senderid string Approved sender id(6 characters string only).
channel string Message channel Promotional=1 or Transactional=2 and OTP=OTP.
DCS string Data coding value (Default is 0 for normal message, Set 8 for unicode sms).
flashsms string Flash message immediate display (Default is 0 for normal sms, Set 1 for immediate display).
number string Recipient mobile number (pass with comma[,] seprated if need to send on more then one number).
text text Your sms content.
route string Pass the route id in this parameter to route the message. Click Here for more information regarding your routeid.
schedtime string Schedule date and time for scheduling message (DateTime formate will be 2014/10/06 20:30:00 PM yyyy/mm/dd hh:mm:ss PM).
groupid string group id for numbers.

Get Method

URL : https://www.smsgatewayhub.com/RestAPI/MT.svc/mt?data=

Single Message

<SmsQueue><Account><User>abc</User><Password>123</Password><SenderId>TESTIN</SenderId><Channel>1</Channel><DCS>0</DCS><FlashSms>0</FlashSms><Route>1</Route></Account><Messages><Message><Number>9198981XXXXX</Number><Text>Messge from xml</Text></Message></Messages></SmsQueue>

Multiple Message

<SmsQueue><Account><User>abc</User><Password>123</Password><SenderId>TESTIN</SenderId><Channel>1</Channel><DCS>0</DCS><FlashSms>0</FlashSms><Route>1</Route></Account><Messages><Message><Number>9198981XXXXX</Number><Text>Messge from xml</Text></Message><Message><Number>9198981XXXXX</Number><Text>Messge from xml</Text></Message></Messages></SmsQueue>

Response : <SmsResponse><ErrorCode>000</ErrorCode><ErrorMessage>Success</ErrorMessage><JobId>2463227</JobId><MessageData><Messages><Number>919898xxxxxx</Number><MessageId>Jb7qIygj2kGp63Q0ZE0rjw</MessageId></Messages></MessageData></SmsResponse>

Query Params

White Right

User

Value (yourusername)

White Right

Password

Value (yourpassword)

White Right

senderid

Value (yoursenderid)

White Right

channel

Value (yourchannel)

White Right

DCS

Value (your data coding value).

White Right

flashsms

Value (your flash sms value)

White Right

number

Value (Recipient mobile number)

White Right

text

Value (Your sms content)

White Right

route

Value (your route id)

White Right

schedtime

Value (your schedule date/time)

White Right

groupid

Value (your group id for numbers)

Parameter Type Description
User string Your system login name
Password string Your system password
senderid string Approved sender id(6 characters string only).
channel string Message channel Promotional=1 or Transactional=2 and OTP=OTP.
DCS string Data coding value (Default is 0 for normal message, Set 8 for unicode sms).
flashsms string Flash message immediate display (Default is 0 for normal sms, Set 1 for immediate display).
number string Recipient mobile number (pass with comma[,] seprated if need to send on more then one number).
text text Your sms content.
route string Pass the route id in this parameter to route the message. Click Here for more information regarding your routeid.
schedtime string Schedule date and time for scheduling message (DateTime formate will be 2014/10/06 20:30:00 PM yyyy/mm/dd hh:mm:ss PM).
groupid string group id for numbers.

Other Url

Balance Check

URL : https://www.smsgatewayhub.com/RestAPI/MT.svc/balance?user=aa&password=aa

<BalanceResponse><ErrorCode>0</ErrorCode><ErrorMessage>Success</ErrorMessage><Balance>P:9#T:10</Balance></BalanceResponse>

Delivery Report

URL : https://www.smsgatewayhub.com/RestAPI/MT.svc/report/2463357

<DeliveryReportResponse><ErrorCode>0</ErrorCode><ErrorMessage>Success</ErrorMessage><DeliveryReports><DeliveryReport><MessageId>6lScvygr5Uiw32Hus7DJRg</MessageId><DeliveryStatus>Delivered</DeliveryStatus><DeliveryDate>2015-11-22T00:02:52.247</DeliveryDate></DeliveryReport><DeliveryReport><MessageId>6lScvygr5Uiw32Hus7DJRg</MessageId><DeliveryStatus>Delivered</DeliveryStatus><DeliveryDate>2015-11-22T00:02:57.483</DeliveryDate></DeliveryReport></DeliveryReports></DeliveryReportResponse>

Sender Id

URL : https://www.smsgatewayhub.com/RestAPI/MT.svc/senderid?user=aa&password=aa&type=1

<SenderIdResponse><ErrorCode>0</ErrorCode><ErrorMessage>Success</ErrorMessage><Type>1</Type><SenderIdList><SenderIds><SenderId>WEBTXT</SenderId></SenderIds><SenderIds><SenderId>TESTIN</SenderId></SenderIds></SenderIdList></SenderIdResponse>

Templates

URL : https://www.smsgatewayhub.com/RestAPI/MT.svc/template?user=aa&password=aa

<TemplatesResponse><ErrorCode>0</ErrorCode><ErrorMessage>Success</ErrorMessage><TemplateId>1</TemplateId><TemplateName>Temp</TemplateName><TemplateString>This is temp %Field% template.</TemplateString></TemplatesResponse>

Groups

URL : https://www.smsgatewayhub.com/RestAPI/MT.svc/groups?user=aa&password=aa

<GroupResponse><ErrorCode>0</ErrorCode><ErrorMessage>Success</ErrorMessage><Group><GroupId>22</GroupId><GroupName>Group1</GroupName><ContactsCount>0</ContactsCount></Group><Group><GroupId>23</GroupId><GroupName>demo</GroupName><ContactsCount>0</ContactsCount></Group><Group><GroupId>25</GroupId><GroupName>mgage</GroupName><ContactsCount>6</ContactsCount></Group><Group><GroupId>26</GroupId><GroupName>DEMO</GroupName><ContactsCount>0</ContactsCount></Group></Groups></GroupResponse>

Misscall API

Tips you can use

A copy of Missed call number & your Toll free number is forwarded to your predefined public URL.
URL Post Status: You can enable or disable url post i.e forwarding of a carbon copy of incoming Missed Call to your url

URL Details: You need to provide your complete url e.g http://yoursite.com/misscallhandler.php

When an incoming message for your Channel comes in, it will be forwarded to your URL as per following details (with the real values) –

http://yoursite.com/misscallhandler.php?who=%who&ChannelID=%channel&Circle=%circle&Operator=%operator&DateTime=%time

The variables we send to you on the query string are :

White Right

Caller

phone numer of the incoming sms

White Right

Channel

Toll free number

White Right

Circle

Circle of incoming missed call number

White Right

Operator

Operator of incoming missed call number

White Right

CallTime

Caller Called DateTime

White Right

Dynamic Respone

You can enable or disable dynamic response as per your requirement. Once we post query string to your url, our server will wait for the response in case dynamic response is enabled. Remeber, dynamic response should be quick enough from your server other wise a time out error may occur.

Make sure there is no HTML is coming in your response.

Voicesms API

Service Description

Voice messaging is an automated way to call many people to deliver a voice message that was prerecorded or converted from a text. Also known as Voice SMS or Voice broadcast or robo calling, it delivers voice messages to any fixed or mobile phone in the world. Text2Speech can also record voice or dial pad responses from the called party. Voice messaging helps many companies save money, because it eliminates the need for call centers to spread messages.

Many companies use Voice messaging to inform their customers of their latest promotions and offers. It is especially effective for spreading time sensitive messages like emergency messages, PINs for 2-Factor Authentication, last minute updates, to generate an opinion on a certain matter, send political messages and various other use cases.

Developer API

Our Voice messaging API is a simple REST API. For an originating call you submit a POST HTTP request with a well-structured body and in response you get a token with which you can identify the originated call. With that token you can poll for call status, or call for a detailed record (CDR), which is an object containing detailed information about a call.

Our API provide several features, other than just playing a voice message to an end user. You can record an entire call and get a download URL of the recorded file. You can tell us not to stop after just one failed try, and if necessary we will retry the call. You can instruct us to wait for the user to enter one digit, and we will provide you with the user's input in CDR. Detailed specification can be found in the following pages.

Simple Voice SMS API

Resource

https://{base_url}/tts/3/single

Parameters

Property Name Type Description
from string (919999999999) Numeric sender ID in E.164 format
to* string Destination address must be written in the international format (Example: 916666666666).
text string Message to be converted to speech and played to subscribers. Message text can be up to 1400 characters long.
language string (en) If the message is in text format, the language in which the message is written must be defined for correct pronunciation. Below, in the Languages section, you can find the list of supported languages. If not set, default language is English [en].
voice object Used to define voice in which text would be synthesized. It has two parameters: name and gender. When only name is provided, then that exact voice with that name will be used to synthesize text. If only gender is provided, then text is synthesized with first voice in given gender. Gender can be male or female. If voice is not set, then default voice is used.
audioFileUrl string Besides the text format of the message, audio recording (format like: wav, mp3, ogg etc.) can also be delivered as a voice message to the recipient. Audio file must be uploaded online so the existing URL can be available for the file download. Size of the audio file must be below 4 MB.

Request Example

JSON :

POST /tts/3/single HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Content-Type: application/json Accept: application/json { "from": "919999999999", "to": "916666666666", "text": "Test Voice message.", "language": "en", "voice": { "name": "Joanna", "gender": "female" } }

cURL :

curl -X POST \ -H "Accept: application/json" \ -H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{ "from": "919999999999", "to": "916666666666", "text": "Test Voice message.", "language": "en", "voice": { "name": "Joanna", "gender": "female" } }' "https://{base_url}/tts/3/single"

PHP :

<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://{base_url}/tts/3/single", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "{\n \"from\": \"919999999999\",\n \"to\": \"916666666666\",\n \"text\": \"Test Voice message.\",\n \"language\": \"en\",\n \"voice\": {\n \"name\": \"Joanna\",\n \"gender\": \"female\" }\n}", CURLOPT_HTTPHEADER => array( "accept: application/json", "authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", "content-type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }

Ruby :

require 'uri' require 'net/http' url = URI("https://{base_url}/tts/3/single") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Post.new(url) request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' request["content-type"] = 'application/json' request["accept"] = 'application/json' request["cache-control"] = 'no-cache' request["postman-token"] = 'feb1ddbf-7c53-9949-7e56-3091808a9e36' request.body = "{\n \"from\": \"919999999999\",\n \"to\": \"916666666666\",\n \"text\": \"Test Voice message.\",\n \"language\": \"en\",\n \"voice\": {\n \"name\": \"Joanna\",\n \"gender\": \"female\" }\n}" response = http.request(request) puts response.read_body

Python :

import http.client conn = http.client.HTTPSConnection("{base_url}") payload = "{\n \"from\": \"919999999999\",\n \"to\": \"916666666666\",\n \"text\": \"Test Voice message.\",\n \"language\": \"en\",\n \"voice\": {\n \"name\": \"Joanna\",\n \"gender\": \"female\" }\n}" headers = { 'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", 'content-type': "application/json", 'accept': "application/json" } conn.request("POST", "/tts/3/single", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))

Java :

HttpResponse<String> response = Unirest.post("https://{base_url}/tts/3/single") .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==") .header("content-type", "application/json") .header("accept", "application/json") .body("{\n \"from\": \"919999999999\",\n \"to\": \"916666666666\",\n \"text\": \"Test Voice message.\",\n \"language\": \"en\",\n \"voice\": {\n \"name\": \"Joanna\",\n \"gender\": \"female\" }\n}") .asString();

C# :

var client = new RestClient("https://{base_url}/tts/3/single"); var request = new RestRequest(Method.POST); request.AddHeader("accept", "application/json"); request.AddHeader("content-type", "application/json"); request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); request.AddParameter("application/json", "{\n \"from\": \"919999999999\",\n \"to\": \"916666666666\",\n \"text\": \"Test Voice message.\",\n \"language\": \"en\",\n \"voice\": {\n \"name\": \"Joanna\",\n \"gender\": \"female\" }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request);

JavaScript :

var data = JSON.stringify({ "from": "919999999999", "to": "916666666666", "text": "Test Voice message.", "language": "en", "voice": { "name": "Joanna", "gender": "female" } }); var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open("POST", "https://{base_url}/tts/3/single"); xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); xhr.setRequestHeader("content-type", "application/json"); xhr.setRequestHeader("accept", "application/json"); xhr.send(data);

Response

200 OK - JSON

{ "messages": [ { "to": "919999999999", "status": { "groupId": 1, "groupName": "PENDING", "id": 7, "name": "PENDING_ENROUTE", "description": "Message sent to next instance" }, "messageId":"2250be2d4219-3af1-78856-aabe-1362af1edfd2" } ] }

Response format

If successful, the response header HTTP status code will be 200 OK and the message will be sent.
If you try to send a message without authorization, you will receive the 401 Unauthorized error .

Voice Response

Parameter Type Description
messages VoiceResponseDetails Array of sent message objects, one object per every message.

VoiceResponseDetails

Parameter Type Description
to String The message destination address.
status Status Indicates whether the message has been successfully sent, not sent, delivered, not delivered, waiting for delivery or any other possible status.
messageId String The ID that uniquely identifies the message sent.

Status

Parameter Type Description
groupId int Status group ID.
groupName String Status group name.
id int Status ID.
name String Status name.
description String Human-readable description of the status.

Languages

Language Abbreviation NAME
Female Male

English

(Indian)

en-in Aditi

Ravi

Heera

(Default)

 
Priya  
Raveena  
Hindi hi

Aadita

(Default)

Hemant

Kalpana  

Multiple Voice SMS API

Resource

https://{base_url}/tts/3/multi

Parameters

Property Name Type Description
from string Numeric sender ID in E.164 format
to* array_string Array of message destination addresses. Destination address must be written in the international format (Example: 919999999999).
text string Text of the message that will be sent. Message text can be up to 1400 characters long.
language string (en) If the message is in text format, the language the message is written in must be defined for correct pronunciation. Below, in the Languages section, you can find the list of supported languages. If not set, default language is English [en].
voice object Used to define voice in which text would be synthesized. It has two parameters: name and gender. When only name is provided, then that exact voice with that name will be used to synthesize text. If only gender is provided, then text is synthesized with first voice in given gender. Gender can be male or female.
audioFileUrl string Besides the text format of the message, audio recording (format like: wav, mp3, ogg, etc.) can also be delivered as a voice message to the recipient. Audio file must be uploaded online so the existing URL can be available for the file download. Size of the audio file must be below 4 MB.

Request Example

JSON :

POST /tts/3/multi HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Content-Type: application/json Accept: application/json { "messages":[ { "from":"919999999999", "to":[ "916666666666", "916666666666" ], "audioFileUrl": "https://www.example.com/media.mp3" }, { "from":"919999999999", "to": ["916666666666"], "text": "Hello world!", "language": "en", "voice": { "name": "Joanna", "gender": "female" } } ] }

cURL :

curl -X POST \ -H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{ "messages":[ { "from":"919999999999", "to":[ "919999999999", "916666666666" ], "audioFileUrl": "https://www.example.com/media.mp3" }, { "from":"99999", "to": ["916666666666"], "text": "Hello world!", "language": "en", "voice": { "name": "Joanna", "gender": "female" } } ] }' "https://{base_url}/tts/3/multi"

PHP :

<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://{base_url}/tts/3/multi", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "{\n \"messages\":[\n {\n \"from\":\"919999999999\",\n \"to\":[\n \"919999999999\",\n \"916666666666\"\n ],\n \"audioFileUrl\": \"https://www.example.com/media.mp3\"\n },\n {\n \"from\":\"919999999999\",\n \"to\": [\"916666666666\"],\n \"text\": \"Hello world!\",\n \"language\": \"en\",\n \"voice\": {\n \"name\": \"Joanna\",\n \"gender\": \"female\"\n }\n }\n ]\n }", CURLOPT_HTTPHEADER => array( "accept: application/json", "authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", "content-type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }

Ruby :

require 'uri' require 'net/http' url = URI("https://{base_url}/tts/3/multi") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Post.new(url) request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' request["content-type"] = 'application/json' request["accept"] = 'application/json' request.body = "{\n \"messages\":[\n {\n \"from\":\"919999999999\",\n \"to\":[\n \"916666666666\",\n \"916666666666\"\n ],\n \"audioFileUrl\": \"https://www.example.com/media.mp3\"\n },\n {\n \"from\":\"919999999999\",\n \"to\": [\"916666666666\"],\n \"text\": \"Hello world!\",\n \"language\": \"en\",\n \"voice\": {\n \"name\": \"Joanna\",\n \"gender\": \"female\"\n }\n }\n ]\n }" response = http.request(request) puts response.read_body

Python :

import http.client conn = http.client.HTTPSConnection("{base_url}") payload = "{\n \"messages\":[\n {\n \"from\":\"919999999999\",\n \"to\":[\n \"916666666666\",\n \"916666666666\"\n ],\n \"audioFileUrl\": \"https://www.example.com/media.mp3\"\n },\n {\n \"from\":\"919999999999\",\n \"to\": [\"916666666666\"],\n \"text\": \"Hello world!\",\n \"language\": \"en\",\n \"voice\": {\n \"name\": \"Joanna\",\n \"gender\": \"female\"\n }\n }\n ]\n }" headers = { 'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", 'content-type': "application/json", 'accept': "application/json" } conn.request("POST", "/tts/3/multi", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))

Java :

HttpResponse<String> response = Unirest.post("https://{base_url}/tts/3/multi") .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==") .header("content-type", "application/json") .header("accept", "application/json") .body("{\n \"messages\":[\n {\n \"from\":\"919999999999\",\n \"to\":[\n \"916666666666\",\n \"916666666666\"\n ],\n \"audioFileUrl\": \"https://www.example.com/media.mp3\"\n },\n {\n \"from\":\"919999999999\",\n \"to\": [\"916666666666\"],\n \"text\": \"Hello world!\",\n \"language\": \"en\",\n \"voice\": {\n \"name\": \"Joanna\",\n \"gender\": \"female\"\n }\n }\n ]\n }") .asString();

C# :

var client = new RestClient("https://{base_url}/tts/3/multi"); var request = new RestRequest(Method.POST); request.AddHeader("accept", "application/json"); request.AddHeader("content-type", "application/json"); request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); request.AddParameter("application/json", "{\n \"messages\":[\n {\n \"from\":\"919999999999\",\n \"to\":[\n \"916666666666\",\n \"916666666666\"\n ],\n \"audioFileUrl\": \"https://www.example.com/media.mp3\"\n },\n {\n \"from\":\"919999999999\",\n \"to\": [\"916666666666\"],\n \"text\": \"Hello world!\",\n \"language\": \"en\",\n \"voice\": {\n \"name\": \"Joanna\",\n \"gender\": \"female\"\n }\n }\n ]\n }", ParameterType.RequestBody); IRestResponse response = client.Execute(request);

JavaScript :

var data = JSON.stringify({ "messages": [ { "from": " 919999999999", "to": [ "916666666666", "916666666666" ], "audioFileUrl": "https://www.example.com/media.mp3" }, { "from": "919999999999", "to": [ "916666666666" ], "text": "Hello world!", "language": "en", "voice": { "name": "Joanna", "gender": "female" } } ] }); var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open("POST", "https://{base_url}/tts/3/multi"); xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); xhr.setRequestHeader("content-type", "application/json"); xhr.setRequestHeader("accept", "application/json"); xhr.send(data);

Response

200 OK

{ "bulkId":"5028e2d42f19-42f1-4656-351e-a42c191e5fd2", "messages": [ { "to": "916666666666", "status": { "groupId": 1, "groupName": "PENDING", "id": 26, "name": "PENDING_ACCEPTED", "description": "Message accepted, pending for delivery." }, "messageId":"4242f196ba50-a356-2f91-831c4aa55f351ed2" }, { "to": "916666666666", "status": { "groupId": 1, "groupName": "PENDING", "id": 26, "name": "PENDING_ACCEPTED", "description": "Message accepted, pending for delivery." }, "messageId":"5f35f896ba50-a356-43a4-91cd81b85f8c689" }, { "to": "916666666666", "status": { "groupId": 1, "groupName": "PENDING", "id": 26, "name": "PENDING_ACCEPTED", "description": "Message accepted, pending for delivery." }, "messageId":"5f35f87a2f19-a141-43a4-91cd81b85f8c689" } ] }

Response format

If successful, the response header HTTP status code will be 200 OK and the message will be sent.
If you try to send the message without authorization, you will receive a 401 Unauthorized error.

Voice Response

Parameter Type Description
bulkId String The ID that uniquely identifies the request. Bulk ID will be received when you send a message to more than one destination address.
messages VoiceResponseDetails Array of sent message objects, one object per every message.

VoiceResponseDetails

Parameter Type Description
to String The message destination address.
status Status Indicates whether the message has been successfully sent, not sent, delivered, not delivered, waiting for delivery or any other possible status.
messageId String The ID that uniquely identifies the message sent.

Status

Parameter Type Description
groupId int Status group ID.
groupName String Status group name.
id int Status ID.
name String Status name.
description String Human-readable description of the status.

Fully Featured Voice API

Resource

https://{base_url}/tts/3/advanced

Parameters

Property Name Type Description
bulkId string The ID which uniquely identifies the request.
from string-919999999999 Numeric sender ID length should be between 3 and 14 characters.
to* array_string Array of message destination addresses. Destination address must be in the international format (Example: 919999999999).
messageId string The ID that uniquely identifies the message sent.
text string Text of the message that will be sent. Pause between words is possible. Message text can be up to 1400 characters long.
language string (en) If the message is in text format, language in which the message is written must be defined for correct pronunciation. Below, in the Languages section, you can find the list of languages that we support. If not set, default language is English [en].
voice object Used to define voice in which text would be synthesized. It has two parameters: name and gender. When only name is provided, then that exact voice with that name will be used to synthesize text. If only gender is provided, then text is synthesized with first voice in given gender. Gender can be male or female. If voice is not set, then default voice is used. 
audioFileUrl string Besides the text format of the message, audio recording (format like: wav, mp3, ogg, etc.) can also be delivered as a voice message to the recipient. Audio file must be uploaded online so the existing URL can be available for the file download. Size of the audio file must be below 4 MB.
speechRate double (1) The reproduction speed of speech in the resulting message. Effective only when using text. Supported range is from 0.5 (slow down speech) to 2 (speed up speech). Values less than 0.5 will be replaced with 0.5, and values higher than 2 will be replaced with 2.
notifyUrl string The URL on your callback server on which the Delivery report will be sent.
notifyContentType string Preferred Delivery report content type. Can be application/json or application/xml.
validityPeriod int The message validity period shown in minutes. When the period expires, it will not be allowed for the message to be sent. A validity period longer than 48h is not supported (in this case, it will be automatically set to 48h).
sendAt datetime Used for scheduled Voice messages (message not to be sent immediately, but at scheduled time).
record boolean Record the call and expose it to client as URL inside the delivery report. Can be true or false.
repeatDtmf string Response (DTMF) code which enables repeating message if a subscriber enters it.
maxDtmf int int(0) Defines the max number of dtmf codes entered by end user that would be received.
ringTimeout int (45) The duration of the call prior to answer shown in seconds, unless there are no operator limitations.
dtmfTimeout int (10) The waiting period for end user to enter dtmf digits.
callTimeout int Total call period shown in seconds.
callTransfers array_object Possible call transfer scenario defined as JSON object. See example below
processKey string Key that uniquely identifies Conversion tracking process.
callbackData string Additional client's data that will be sent on the notifyUrl. The maximum value is 200 characters.
pause int (0) Indicating period of time in seconds between end user answering the call and message starting to be played. Minimal value is 0 and maximum value is 10 seconds.
retry object Used to define if the delivery of the Voice messages should be retried in case the first try doesn't succeed. Additional retries will be made according to the schedule defined by minPeriod and maxPeriod parameters and platform's internal retry logic. If the minPeriod differs maxPeriod, delivery will be retried in the following manner: after 1 min, 2 min, 5 min, 10 min, 20 min, 30 min, 1 hour, 2 hours, 4 hours, 8 hours, 16 hours, 24 hours or until maxPeriod is reached.  If the retry attempt for the MaxPeriod is reached, the MaxPeriod will be used for all subsequent retries. If the minPeriod and the maxPeriod are defined as equal values, the period of time between retries will be equal to this value. Message delivery will be retried until the successful delivery or message validity or maxCount value is reached.
minPeriod int Defines the minimal waiting time (in minutes) after the previous failed attempt to try to deliver the message again.
maxPeriod int Defines the maximum waiting time (in minutes) after the previous failed attempt to try to deliver the message again.
maxCount int Specify the maximum number of retry attempts. Maximum value of the maxCount is 4. Higher value, if entered will be set to 4.
sendingSpeed object Sending rate defined in number of messages sent per second, minute, hour or day. First message will be sent immediately (or at sendAt time if scheduling is used) and subsequent messages will be sent respecting defined speed. For example, if sendingSpeed is defined as 10 messages per hour, messages will be sent every 6 minutes. If this parameter is defined, validityPeriod is ignored.
speed int Defines the number of messages that will be sent per specified time unit.
timeUnit string Defines time unit used for calculating sending speed.  Possible values: second, minute, hour and day.
machineDetection string Used for enabling detection of answering machine after the call has been answered. It can be set to "hangup" or "continue". When set to "hangup", if a machine is detected call is hung up. When set to "continue", if a machine is detected, then voice message starts playing into voice mail after the answering message is finished with its greeting.
If machineDetection is used, there is a minimum of 4 seconds detection time, which can result in delay of playing the message.
Answering machine detection is additionally charged. For more information please contact your account manager.

Request Example

JSON :

POST /tts/3/advanced HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Content-Type: application/json Accept: application/json { "bulkId": "BULK-ID-123-xyz", "messages": [ { "from": "919999999999", "destinations": [ { "to": "916666666666", "messageId": "MESSAGE-ID-123-xyz" }, { "to": "916666666666" } ], "text": "Test Voice message.", "language": "en", "voice": { "name": "Joanna", "gender": "female" }, "speechRate": 1, "notifyUrl": "https://www.example.com/voice/advanced", "notifyContentType": "application/json", "callbackData":"DLR callback data", "validityPeriod": 720, "sendAt": "2016-07-07T17:00:00.000+01:00", "record": false, "repeatDtmf": "123#", "maxDtmf":1, "ringTimeout": 45, "dtmfTimeout": 10, "callTimeout": 130, "pause": 3, "retry": { "minPeriod":1, "maxPeriod": 5, "maxCount":5 }, "machineDetection": "continue" }, { "from": "919999999999", "destinations": [ { "to": "916666666666" } ], "text": "A long time ago, in a galaxy far.", "sendAt": "2016-07-07T18:00:00.000+01:00" } ], "tracking":{ "track": "VOICE", "type": "MY_CAMPAIGN" } }

cURL :

curl -X POST \ -H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{ "bulkId":"BULK-ID-123-xyz", "messages":[ { "from":"919999999999", "destinations":[ { "to":"916666666666", "messageId":"MESSAGE-ID-123-xyz" }, { "to":"916666666666" } ], "text": "Test Voice message.", "language": "en", "voice": { "name": "Joanna", "gender": "female" }, "speechRate":1, "notifyUrl":"https://www.example.com/voice/advanced", "notifyContentType":"application/json", "validityPeriod": 720, "sendAt":"2016-07-07T17:00:00.000+01:00", "record": false, "repeatDtmf": "123#", "maxDtmf": 1 "ringTimeout": 45, "dtmfTimeout": 10, "callTimeout": 130, "pause": 3, "retry": { "minPeriod":1, "maxPeriod": 5, "maxCount":5 }, "machineDetection": "continue" }, { "from":"919999999999", "destinations":[ { "to":"916666666666" } ], "text":"A long time ago, in a galaxy far.", "sendAt":"2016-07-07T18:00:00.000+01:00" } ] }' "https://{base_url}/tts/3/advanced"

PHP :

<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://{base_url}/tts/3/advanced", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "{ \"bulkId\": \"BULK-ID-123-xyz\", \"messages\": [ { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\", \"messageId\": \"MESSAGE-ID-123-xyz\" }, { \"to\": \"916666666666\" } ], \"text\": \"Test Voice message.\", \"language\": \"en\", \"voice\": { \"name\": \"Joanna\", \"gender\": \"female\" }, \"speechRate\": 1, \"notifyUrl\": \"https://www.example.com/voice/advanced\", \"notifyContentType\": \"application/json\", \"validityPeriod\": 720, \"sendAt\": \"2016-07-07T17:00:00.000+01:00\", \"record\": false, \"repeatDtmf\": \"123#\", \"maxDtmf\": 1, \"ringTimeout\": 45, \"dtmfTimeout\": 10, \"callTimeout\": 130, \"pause\": 3, \"retry\": { \"minPeriod\": 1, \"maxPeriod\": 5, \"maxCount\": 5 }, \"machineDetection\": \"continue\" }, { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\" } ], \"text\": \"A long time ago, in a galaxy far.\", \"sendAt\": \"2016-07-07T18:00:00.000+01:00\" } ] }", CURLOPT_HTTPHEADER => array( "accept: application/json", "authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", "content-type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }

Ruby :

require 'uri' require 'net/http' url = URI("https://{base_url}/tts/3/advanced") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Post.new(url) request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' request["content-type"] = 'application/json' request["accept"] = 'application/json' request.body = "{ \"bulkId\": \"BULK-ID-123-xyz\", \"messages\": [ { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\", \"messageId\": \"MESSAGE-ID-123-xyz\" }, { \"to\": \"916666666666\" } ], \"text\": \"Test Voice message.\", \"language\": \"en\", \"voice\": { \"name\": \"Joanna\", \"gender\": \"female\" }, \"speechRate\": 1, \"notifyUrl\": \"https://www.example.com/voice/advanced\", \"notifyContentType\": \"application/json\", \"validityPeriod\": 720, \"sendAt\": \"2016-07-07T17:00:00.000+01:00\", \"record\": false, \"repeatDtmf\": \"123#\", \"maxDtmf\": 1, \"ringTimeout\": 45, \"dtmfTimeout\": 10, \"callTimeout\": 130, \"pause\": 3, \"retry\": { \"minPeriod\": 1, \"maxPeriod\": 5, \"maxCount\": 5 }, \"machineDetection\": \"continue\" }, { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\" } ], \"text\": \"A long time ago, in a galaxy far.\", \"sendAt\": \"2016-07-07T18:00:00.000+01:00\" } ] }", response = http.request(request) puts response.read_body

Python :

import http.client conn = http.client.HTTPSConnection("{base_url}") payload = "{ \"bulkId\": \"BULK-ID-123-xyz\", \"messages\": [ { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\", \"messageId\": \"MESSAGE-ID-123-xyz\" }, { \"to\": \"916666666666\" } ], \"text\": \"Test Voice message.\", \"language\": \"en\", \"voice\": { \"name\": \"Joanna\", \"gender\": \"female\" }, \"speechRate\": 1, \"notifyUrl\": \"https://www.example.com/voice/advanced\", \"notifyContentType\": \"application/json\", \"validityPeriod\": 720, \"sendAt\": \"2016-07-07T17:00:00.000+01:00\", \"record\": false, \"repeatDtmf\": \"123#\", \"maxDtmf\": 1, \"ringTimeout\": 45, \"dtmfTimeout\": 10, \"callTimeout\": 130, \"pause\": 3, \"retry\": { \"minPeriod\": 1, \"maxPeriod\": 5, \"maxCount\": 5 }, \"machineDetection\": \"continue\" }, { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\" } ], \"text\": \"A long time ago, in a galaxy far.\", \"sendAt\": \"2016-07-07T18:00:00.000+01:00\" } ] }" headers = { 'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", 'content-type': "application/json", 'accept': "application/json" } conn.request("POST", "/tts/3/advanced", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))

Java :

HttpResponse<String> response = Unirest.post("https://{base_url}/tts/3/advanced") .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==") .header("content-type", "application/json") .header("accept", "application/json") .body("{ \"bulkId\": \"BULK-ID-123-xyz\", \"messages\": [ { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\", \"messageId\": \"MESSAGE-ID-123-xyz\" }, { \"to\": \"916666666666\" } ], \"text\": \"Test Voice message.\", \"language\": \"en\", \"voice\": { \"name\": \"Joanna\", \"gender\": \"female\" }, \"speechRate\": 1, \"notifyUrl\": \"https://www.example.com/voice/advanced\", \"notifyContentType\": \"application/json\", \"validityPeriod\": 720, \"sendAt\": \"2016-07-07T17:00:00.000+01:00\", \"record\": false, \"repeatDtmf\": \"123#\", \"maxDtmf\": 1, \"ringTimeout\": 45, \"dtmfTimeout\": 10, \"callTimeout\": 130, \"pause\": 3, \"retry\": { \"minPeriod\": 1, \"maxPeriod\": 5, \"maxCount\": 5 }, \"machineDetection\": \"continue\" }, { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\" } ], \"text\": \"A long time ago, in a galaxy far.\", \"sendAt\": \"2016-07-07T18:00:00.000+01:00\" } ] }") .asString();

C# :

var client = new RestClient("https://{base_url}/tts/3/advanced"); var request = new RestRequest(Method.POST); request.AddHeader("accept", "application/json"); request.AddHeader("content-type", "application/json"); request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); request.AddParameter("application/json", "{ \"bulkId\": \"BULK-ID-123-xyz\", \"messages\": [ { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\", \"messageId\": \"MESSAGE-ID-123-xyz\" }, { \"to\": \"916666666666\" } ], \"text\": \"Test Voice message.\", \"language\": \"en\", \"voice\": { \"name\": \"Joanna\", \"gender\": \"female\" }, \"speechRate\": 1, \"notifyUrl\": \"https://www.example.com/voice/advanced\", \"notifyContentType\": \"application/json\", \"validityPeriod\": 720, \"sendAt\": \"2016-07-07T17:00:00.000+01:00\", \"record\": false, \"repeatDtmf\": \"123#\", \"maxDtmf\": 1, \"ringTimeout\": 45, \"dtmfTimeout\": 10, \"callTimeout\": 130, \"pause\": 3, \"retry\": { \"minPeriod\": 1, \"maxPeriod\": 5, \"maxCount\": 5 }, \"machineDetection\": \"continue\" }, { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\" } ], \"text\": \"A long time ago, in a galaxy far.\", \"sendAt\": \"2016-07-07T18:00:00.000+01:00\" } ] }", ParameterType.RequestBody); IRestResponse response = client.Execute(request);

JavaScript :

var data = JSON.stringify({ "bulkId": "BULK-ID-123-xyz", "messages": [ { "from": "919999999999", "destinations": [ { "to": "916666666666", "messageId": "MESSAGE-ID-123-xyz" }, { "to": "916666666666" } ], "text": "Test Voice message.", "language": "en", "voice": { "name": "Joanna", "gender": "female" }, "speechRate": 1, "notifyUrl": "https://www.example.com/voice/advanced", "notifyContentType": "application/json", "validityPeriod": 720, "sendAt": "2016-07-07T17:00:00.000+01:00", "record": false, "repeatDtmf": "123#", "repeatDtmf": 1, "ringTimeout": 45, "dtmfTimeout": 10, "callTimeout": 130, "pause": 3, "retry": { "minPeriod":1, "maxPeriod": 5, "maxCount":5 }, "machineDetection": "continue" }, { "from": "919999999999", "destinations": [ { "to": "916666666666" } ], "text": "A long time ago, in a galaxy far.", "sendAt": "2016-07-07T18:00:00.000+01:00" } ] }); var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open("POST", "https://{base_url}/tts/3/advanced"); xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); xhr.setRequestHeader("content-type", "application/json"); xhr.setRequestHeader("accept", "application/json"); xhr.send(data);

Response

200 OK

{ "bulkId": "BULK-ID-123-xyz", "messages": [ { "to": "916666666666", "status": { "groupId": 1, "groupName": "PENDING", "id": 26, "name": "PENDING_ACCEPTED", "description": "Message accepted, pending for delivery." }, "messageId": "MESSAGE-ID-123-xyz" }, { "to": "916666666666", "status": { "groupId": 1, "groupName": "PENDING", "id": 26, "name": "PENDING_ACCEPTED", "description": "Message accepted, pending for delivery." }, "messageId":"9304a5a3ab19-1ca1-be74-76ad87651ed25f35" }, { "to": "916666666666", "status": { "groupId": 1, "groupName": "PENDING", "id": 26, "name": "PENDING_ACCEPTED", "description": "Message accepted, pending for delivery." }, "messageId":"5f35f87a2f19-a141-43a4-91cd81b85f8c689" } ] }

Response format

If successful, the response header HTTP status code will be 200 OK and the message will be sent.
If you try to send the message without authorization, you will receive a 401 Unauthorized error.

VoiceResponse

Property Name Type Description
bulkId String The ID that uniquely identifies the request. Bulk ID will be received when a message is sent to more than one destination address.
messages VoiceResponseDetails Array of sent message objects, one object per every message.

VoiceResponseDetails

Property Name Type Description
to String The message destination address.
status Status Indicates whether the message has been sent successfully, not sent, delivered, not delivered, waiting for delivery or any other possible status.
messageId String The ID that uniquely identifies the sent message.

Status

Parameter Type Description
groupId int Status group ID.
groupName String Status group name.
id int Status ID.
name String Status name.
description String Human-readable description of the status.

Pause between words

Adding pauses between the words and extending the duration of the voice message is possible by using the comma character ",".

For example, if you want to have a 3 second pause after each word, then the text parameter should look like this "one,,,,,,two,,,,,,three,,,,,,". Each coma creates a pause of 0,5 seconds.

Ring timeout limitations

There are no limitations on the Voice platform regarding this value, however, most of the operators have their own ring timeout limitations and it is advisable to keep the ringTimeout value up to 45s.

Call Transfers

Using call transfer, you can send an interactive message to your subscribers, providing them the opportunity to respond by pressing their phone keys. When your subscriber chooses a number call transfer will redirect a call to the set number. The Field is JSON formatted.

Call transfer for any DTMF

[ { "if": "anyDtmf", "transferTo": "919999999999", "callTransferMaxDuration": 10 } ]

Call transfer for specific DTMF

[ { "if": "dtmf", "equals": "1", "transferTo": "919999999999" }, { "if": "dtmf", "equals": "2", "transferTo": "919999999999" } ]

Request example

JSON :

POST /tts/3/advanced HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Content-Type: application/json Accept: application/json { "bulkId":"BULK-ID-123-xyz", "messages":[ { "from":"919999999999", "destinations":[ { "to":"916666666666", "messageId":"MESSAGE-ID-123-xyz" }, { "to":"916666666666" } ], "text": "Test Voice message.", "language": "en", "voice": { "name": "Joanna", "gender": "female" }, "speechRate":1, "notifyUrl":"http://www.example.com/voice/advanced", "notifyContentType":"application/json", "validityPeriod": 720, "sendAt":"2016-07-07T17:00:00.000+01:00", "record": false, "repeatDtmf": "123#", "maxDtmf":1, "ringTimeout": 45, "dtmfTimeout": 10, "callTimeout": 130, "pause":3, "retry": { "minPeriod":1, "maxPeriod": 5, "maxCount":5 }, "callTransfers": [ { "if": "dtmf", "equals": "1", "transferTo": "916666666666" }, { "if": "dtmf", "equals": "2", "transferTo": "916666666666" } ] }, { "from":"919999999999", "destinations":[ { "to":"916666666666" } ], "text":"A long time ago, in a galaxy far.", "sendAt":"2016-07-07T18:00:00.000+01:00" } ] }

cURL :

curl -X POST \ -H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{ "bulkId":"BULK-ID-123-xyz", "messages":[ { "from":"919999999999", "destinations":[ { "to":"916666666666", "messageId":"MESSAGE-ID-123-xyz" }, { "to":"916666666666" } ], "text": "Test Voice message.", "language": "en", "speechRate":1, "notifyUrl":"http://www.example.com/voice/advanced", "notifyContentType":"application/json", "validityPeriod": 720, "sendAt":"2016-07-07T17:00:00.000+01:00", "record": false, "repeatDtmf": "123#", "maxDtmf":1, "ringTimeout": 45, "dtmfTimeout": 10, "callTimeout": 130, "pause": 3, "retry": { "minPeriod":1, "maxPeriod": 5, "maxCount":5 }, "callTransfers": [ { "if": "dtmf", "equals": "1", "transferTo": "916666666666" }, { "if": "dtmf", "equals": "2", "transferTo": "916666666666" } ] }, { "from":"919999999999", "destinations":[ { "to":"916666666666" } ], "text":"A long time ago, in a galaxy far.", "sendAt":"2016-07-07T18:00:00.000+01:00" } ] }' "http://{base_url}/tts/3/advanced"

PHP :

<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "http://{base_url}/tts/3/advanced", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "{ \"bulkId\": \"BULK-ID-123-xyz\", \"messages\": [ { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\", \"messageId\": \"MESSAGE-ID-123-xyz\" }, { \"to\": \"916666666666\" } ], \"text\": \"Test Voice message.\", \"language\": \"en\", \"speechRate\": 1, \"notifyUrl\": \"http://www.example.com/voice/advanced\", \"notifyContentType\": \"application/json\", \"validityPeriod\": 720, \"sendAt\": \"2016-07-07T17:00:00.000+01:00\", \"record\": false, \"repeatDtmf\": \"123#\", \"maxDtmf\": \"1\", \"ringTimeout\": 45, \"dtmfTimeout\": 10, \"callTimeout\": 130, \"pause\": 3, \"retry\": { \"minPeriod\": 1, \"maxPeriod\": 5, \"maxCount\": 5 }, \"callTransfers\": [ { \"if\": \"dtmf\", \"equals\": \"1\", \"transferTo\": \"916666666666\" }, { \"if\": \"dtmf\", \"equals\": \"2\", \"transferTo\": \"916666666666\" } ] }, { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\" } ], \"text\": \"A long time ago, in a galaxy far.\", \"sendAt\": \"2016-07-07T18:00:00.000+01:00\" } ] }", CURLOPT_HTTPHEADER => array( "accept: application/json", "authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", "content-type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }

Ruby :

require 'uri' require 'net/http' url = URI("http://{base_url}/tts/3/advanced") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Post.new(url) request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' request["content-type"] = 'application/json' request["accept"] = 'application/json' request.body = "{ \"bulkId\": \"BULK-ID-123-xyz\", \"messages\": [ { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\", \"messageId\": \"MESSAGE-ID-123-xyz\" }, { \"to\": \"916666666666\" } ], \"text\": \"Test Voice message.\", \"language\": \"en\", \"speechRate\": 1, \"notifyUrl\": \"http://www.example.com/voice/advanced\", \"notifyContentType\": \"application/json\", \"validityPeriod\": 720, \"sendAt\": \"2016-07-07T17:00:00.000+01:00\", \"record\": false, \"repeatDtmf\": \"123#\", \"maxDtmf\": \"1\", \"ringTimeout\": 45, \"dtmfTimeout\": 10, \"callTimeout\": 130, \"pause\": 3, \"retry\": { \"minPeriod\": 1, \"maxPeriod\": 5, \"maxCount\": 5 }, \"callTransfers\": [ { \"if\": \"dtmf\", \"equals\": \"1\", \"transferTo\": \"916666666666\" }, { \"if\": \"dtmf\", \"equals\": \"2\", \"transferTo\": \"916666666666\" } ] }, { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\" } ], \"text\": \"A long time ago, in a galaxy far.\", \"sendAt\": \"2016-07-07T18:00:00.000+01:00\" } ] }" response = http.request(request) puts response.read_body

Python :

import http.client conn = http.client.HTTPConnection("{base_url}") payload = "{ \"bulkId\": \"BULK-ID-123-xyz\", \"messages\": [ { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\", \"messageId\": \"MESSAGE-ID-123-xyz\" }, { \"to\": \"916666666666\" } ], \"text\": \"Test Voice message.\", \"language\": \"en\", \"speechRate\": 1, \"notifyUrl\": \"http://www.example.com/voice/advanced\", \"notifyContentType\": \"application/json\", \"validityPeriod\": 720, \"sendAt\": \"2016-07-07T17:00:00.000+01:00\", \"record\": false, \"repeatDtmf\": \"123#\", \"maxDtmf\": \"1\", \"ringTimeout\": 45, \"dtmfTimeout\": 10, \"callTimeout\": 130, \"pause\": 3, \"retry\": { \"minPeriod\": 1, \"maxPeriod\": 5, \"maxCount\": 5 }, \"callTransfers\": [ { \"if\": \"dtmf\", \"equals\": \"1\", \"transferTo\": \"916666666666\" }, { \"if\": \"dtmf\", \"equals\": \"2\", \"transferTo\": \"916666666666\" } ] }, { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\" } ], \"text\": \"A long time ago, in a galaxy far.\", \"sendAt\": \"2016-07-07T18:00:00.000+01:00\" } ] }" headers = { 'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", 'content-type': "application/json", 'accept': "application/json" } conn.request("POST", "/tts/3/advanced", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))

Java :

HttpResponse<String> response = Unirest.post("http://{base_url}/tts/3/advanced") .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==") .header("content-type", "application/json") .header("accept", "application/json") .body("{ \"bulkId\": \"BULK-ID-123-xyz\", \"messages\": [ { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\", \"messageId\": \"MESSAGE-ID-123-xyz\" }, { \"to\": \"916666666666\" } ], \"text\": \"Test Voice message.\", \"language\": \"en\", \"speechRate\": 1, \"notifyUrl\": \"http://www.example.com/voice/advanced\", \"notifyContentType\": \"application/json\", \"validityPeriod\": 720, \"sendAt\": \"2016-07-07T17:00:00.000+01:00\", \"record\": false, \"repeatDtmf\": \"123#\", \"maxDtmf\": \"1\", \"ringTimeout\": 45, \"dtmfTimeout\": 10, \"callTimeout\": 130, \"pause\": 3, \"retry\": { \"minPeriod\": 1, \"maxPeriod\": 5, \"maxCount\": 5 }, \"callTransfers\": [ { \"if\": \"dtmf\", \"equals\": \"1\", \"transferTo\": \"916666666666\" }, { \"if\": \"dtmf\", \"equals\": \"2\", \"transferTo\": \"916666666666\" } ] }, { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\" } ], \"text\": \"A long time ago, in a galaxy far.\", \"sendAt\": \"2016-07-07T18:00:00.000+01:00\" } ] }") .asString();

C# :

var client = new RestClient("http://{base_url}/tts/3/advanced"); var request = new RestRequest(Method.POST); request.AddHeader("accept", "application/json"); request.AddHeader("content-type", "application/json"); request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); request.AddParameter("application/json", "{ \"bulkId\": \"BULK-ID-123-xyz\", \"messages\": [ { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\", \"messageId\": \"MESSAGE-ID-123-xyz\" }, { \"to\": \"916666666666\" } ], \"text\": \"Test Voice message.\", \"language\": \"en\", \"speechRate\": 1, \"notifyUrl\": \"http://www.example.com/voice/advanced\", \"notifyContentType\": \"application/json\", \"validityPeriod\": 720, \"sendAt\": \"2016-07-07T17:00:00.000+01:00\", \"record\": false, \"repeatDtmf\": \"123#\", \"maxDtmf\": \"1\", \"ringTimeout\": 45, \"dtmfTimeout\": 10, \"callTimeout\": 130, \"pause\": 3, \"retry\": { \"minPeriod\": 1, \"maxPeriod\": 5, \"maxCount\": 5 }, \"callTransfers\": [ { \"if\": \"dtmf\", \"equals\": \"1\", \"transferTo\": \"916666666666\" }, { \"if\": \"dtmf\", \"equals\": \"2\", \"transferTo\": \"916666666666\" } ] }, { \"from\": \"919999999999\", \"destinations\": [ { \"to\": \"916666666666\" } ], \"text\": \"A long time ago, in a galaxy far.\", \"sendAt\": \"2016-07-07T18:00:00.000+01:00\" } ] }", ParameterType.RequestBody); IRestResponse response = client.Execute(request);

JavaScript :

var data = JSON.stringify({ "bulkId": "BULK-ID-123-xyz", "messages": [ { "from": "919999999999", "destinations": [ { "to": "916666666666", "messageId": "MESSAGE-ID-123-xyz" }, { "to": "916666666666" } ], "text": "Test Voice message.", "language": "en", "speechRate": 1, "notifyUrl": "http://www.example.com/voice/advanced", "notifyContentType": "application/json", "validityPeriod": 720, "sendAt": "2016-07-07T17:00:00.000+01:00", "record": false, "repeatDtmf": "123#", "maxDtmf": "1", "ringTimeout": 45, "dtmfTimeout": 10, "callTimeout": 130, "pause": 3, "callTransfers": [ { "if": "dtmf", "equals": "1", "transferTo": "916666666666" }, { "if": "dtmf", "equals": "2", "transferTo": "916666666666" } ] }, { "from": "919999999999", "destinations": [ { "to": "916666666666" } ], "text": "A long time ago, in a galaxy far.", "sendAt": "2016-07-07T18:00:00.000+01:00" } ] }); var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open("POST", "http://{base_url}/tts/3/advanced"); xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); xhr.setRequestHeader("content-type", "application/json"); xhr.setRequestHeader("accept", "application/json"); xhr.send(data);

API response

JSON

{ "bulkId": "BULK-ID-123-xyz", "messages": [ { "to": "916666666666", "status": { "groupId": 1, "groupName": "PENDING", "id": 26, "name": "PENDING_ACCEPTED", "description": "Message accepted, pending for delivery." }, "messageId": "MESSAGE-ID-123-xyz" }, { "to": "916666666666", "status": { "groupId": 1, "groupName": "PENDING", "id": 26, "name": "PENDING_ACCEPTED", "description": "Message accepted, pending for delivery." }, "messageId":"9304a5a3ab19-1ca1-be74-76ad87651ed25f35" }, { "to": "916666666666", "status": { "groupId": 1, "groupName": "PENDING", "id": 26, "name": "PENDING_ACCEPTED", "description": "Message accepted, pending for delivery." }, "messageId":"f0401b7b-5c44-4a62-8a1b-61ec26101ff0" } ] }

Delivery Reports

Resource

https://{base_url}/tts/3/reports

Parameters

Property Name Type Description
bulkId string The ID that uniquely identifies the request. Bulk ID will be received only when you send a message to more than one destination address.
messageId string The ID that uniquely identifies the message sent.
limit string The maximum number of returned delivery reports. Default value is 50.

Request Example

JSON

GET /tts/3/reports HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/json

Response

200 OK

{ "results":[ { "bulkId":"8c20f086-d82b-48cc-b2b3-3ca5f7aca9fb", "messageId":"ff4804ef-6ab6-4abd-984d-ab3b1387e852", "to":"385981178", "sentAt": "2018-06-25T13:38:14.730+0000", "doneAt": "2018-06-25T13:38:28.318+0000", "startTime": "2018-06-25T13:38:15.000+0000", "endTime": "2018-06-25T13:38:28.316+0000", "answerTime": "2018-06-25T13:38:25.000+0000", "duration":10, "fileDuration": 19.3, "mccMnc": "21901", "callbackData": "DLR callback data", "dtmfCodes":"1", "recordedAudioFileUrl":"/tts/3/files/ff4804ef-6ab6-4abd-984d-ab3b1387e852/385981178", "price":{ "pricePerSecond":0.01, "currency":"EUR" }, "status":{ "id":5, "groupId":3, "groupName":"DELIVERED", "name":"DELIVERED_TO_HANDSET", "description":"Message delivered to handset" }, "error":{ "groupId":0, "groupName":"OK", "id": 5000, "name": "VOICE_ANSWERED", "description": "Call answered by human", "permanent": true } } ] }

Response format

If successful, the response header HTTP status code will be 200 OK and delivery reports will be returned in the response body.

If you try to send a message without authorization, you will get a response with the HTTP status code 401 Unauthorized.

VoiceReportResponse

Parameter Type Description
results VoiceReport Collection of reports, one per every message.

VoiceReport

Parameter Type Description
bulkId String Bulk ID.
messageId String Message ID.
to String Destination address.
sentAt Date Tells when the voice message was sent. Has the following format: yyyy-MM-dd'T'HH:mm:ss.SSSZ.
doneAt Date Tells when the voice message was processed by Infobip (ie. delivered to destination, delivered to destination network, etc.).
startTime Date Tells when the voice message call was established and started ringing.
endTime Date Tells when the voice message call was ended.
answerTime Date Tells when the voice message call was answered.
duration int Duration of the Voice message call.
fileDuration Double Duration of the Voice message audio file.
mccMnc String Mobile country and network codes.
callbackData String Callback data sent through callbackData field in fully featured Voice message.
dtmfCodes String DTMF code entered by user.
recordedAudioFileUrl String Url to retrieve recorded calls that were made by messages with the record feature activated.
price Price Sent voice message price.
status Status Indicates whether the message is successfully sent, not sent, delivered, not delivered, waiting for delivery or any other possible status.
error Error Indicates whether the error occurred during the query execution.

Price

Parameter Type Description
pricePerSecond BigDecimal Price per one second of the voice message.
currency String The currency in which the price is expressed.

Status

Parameter Type Description
groupId int Status group ID.
groupName String Status group name.
id int Status ID.
name String Status name.
description String Human-readable description of the status.

Error

Parameter Type Description
groupId int Error group ID.
groupName String Error group name.
id int Error ID.
name String Error name.
description String Human-readable description of the Error.
permanent boolean Tells if the error is permanent.

Recorded Audio File

If the option to record was enabled, the response will contain the recordedAudioFileUrl field. Using that URL with GET method will initiate the download of the recorded file. If using a REST testing client, make sure to save the downloaded data instead of displaying it in the client's response area. Recordings are encoded as PCM WAVE signed little-endian 16bit 8kHz audio files.

DELIVERY REPORT WILL BE RETURNED ONLY ONCE!
Delivery reports are returned only once. Additional delivery report request will return an empty collection.

Additional examples

Getting reports without any query parameter

Request :

JSON :

GET /tts/3/reports HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/json

XML :

GET /tts/3/reports HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/xml

cURL :

curl -X GET \ -H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ "http://{base_url}/tts/3/reports"

PHP :

<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "http://{base_url}/tts/3/reports", 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==", "content-type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }

Ruby :

require 'uri' require 'net/http' url = URI("http://{base_url}/tts/3/reports") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Get.new(url) request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' request["content-type"] = 'application/json' request["accept"] = 'application/json' response = http.request(request) puts response.read_body

Python :

import http.client conn = http.client.HTTPConnection("{base_url}") payload = "" headers = { 'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", 'content-type': "application/json", 'accept': "application/json" } conn.request("GET", "/tts/3/reports", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))

Java :

HttpResponse response = Unirest.get("http://{base_url}/tts/3/reports") .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==") .header("content-type", "application/json") .header("accept", "application/json") .asString();

C# :

var client = new RestClient("http://{base_url}/tts/3/reports"); var request = new RestRequest(Method.GET); request.AddHeader("accept", "application/json"); request.AddHeader("content-type", "application/json"); request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); IRestResponse response = client.Execute(request);

JavaScript :

var data = JSON.stringify(false); var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open("GET", "http://{base_url}/tts/3/reports"); xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); xhr.setRequestHeader("content-type", "application/json"); xhr.setRequestHeader("accept", "application/json"); xhr.send(data);

Response :

JSON :

HTTP/1.1 200 OK Content-Type: application/json { "results":[ { "bulkId":"8c20f086-d82b-48cc-b2b3-3ca5f7aca9fb", "messageId":"ff4804ef-6ab6-4abd-984d-ab3b1387e852", "to":"385981178", "sentAt":"2015-02-12T09:58:20.323+0100", "doneAt":"2015-02-12T09:58:20.337+0100", "sentAt": "2018-06-25T13:38:14.730+0000", "doneAt": "2018-06-25T13:38:28.318+0000", "startTime": "2018-06-25T13:38:15.000+0000", "endTime": "2018-06-25T13:38:28.316+0000", "answerTime": "2018-06-25T13:38:25.000+0000", "duration":10, "fileDuration": 19.3, "mccMnc": "21901", "callbackData": "DLR callback data", "dtmfCodes":"1", "recordedAudioFileUrl":"/tts/3/files/ff4804ef-6ab6-4abd-984d-ab3b1387e852/385981178", "price":{ "pricePerSecond":0.01, "currency":"EUR" }, "status":{ "id":5, "groupId":3, "groupName":"DELIVERED", "name":"DELIVERED_TO_HANDSET", "description":"Message delivered to handset" }, "error":{ "groupId":0, "groupName":"OK", "id": 5000, "name": "VOICE_ANSWERED", "description": "Call answered by human", "permanent": true } } ] }

XML :

HTTP/1.1 200 OK Content-Type: application/xml <reportResponse> <results> <result> <bulkId>8c20f086-d82b-48cc-b2b3-3ca5f7aca9fb</bulkId> <messageId>ff4804ef-6ab6-4abd-984d-ab3b1387e852</messageId> <to>385981178</to> <sentAt>2015-02-12T09:58:20.323+0100</sentAt> <doneAt>2015-02-12T09:58:20.337+0100</doneAt> <duration>10</duration> <mccMnc>21901</mccMnc> <dtmfCodes>1</dtmfCodes> <recordedAudioFileUrl>https://{base_url}/tts/3/files/ff4804ef-6ab6-4abd-984d-ab3b1387e852/385981178</recordedAudioFileUrl> <price> <pricePerMessage>0.01</pricePerMessage> <currency>EUR</currency> </price> <status> <id>5</id> <groupId>3v/groupId> <groupName>DELIVERED</groupName> <name>DELIVERED_TO_HANDSET</name> <description>Message delivered to handset</description> </status> <error> <groupId>0</groupId> <groupName>OK</groupName> <id>5000</id> <name>VOICE_ANSWERED</name> <description>Call answered by human</description> <ermanent>true</permanent> </error> </result> </results> </reportResponse>

Getting the two initial delivery reports

Request :

JSON :

GET /tts/3/reports?limit=2 HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/json

XML :

GET /tts/3/reports?limit=2 HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/xml

cURL :

curl -X GET -H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" -H "Content-Type: application/json" -H "Accept: application/json" "http://{base_url}/tts/3/reports?limit=2"

PHP :

<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "http://{base_url}/tts/3/reports?limit=2", 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==", "content-type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }

Ruby :

require 'uri' require 'net/http' url = URI("http://{base_url}/tts/3/reports?limit=2") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Get.new(url) request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' request["content-type"] = 'application/json' request["accept"] = 'application/json' response = http.request(request) puts response.read_body

Python :

import http.client conn = http.client.HTTPConnection("{base_url}") payload = "" headers = { 'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", 'content-type': "application/json", 'accept': "application/json" } conn.request("GET", "/tts/3/reports?limit=2", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))

Java :

HttpResponse<String> response = Unirest.get("http://{base_url}/tts/3/reports?limit=2") .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==") .header("content-type", "application/json") .header("accept", "application/json") .asString();

C# :

var client = new RestClient("http://{base_url}/tts/3/reports?limit=2"); var request = new RestRequest(Method.GET); request.AddHeader("accept", "application/json"); request.AddHeader("content-type", "application/json"); request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); IRestResponse response = client.Execute(request);

JavaScript :

var data = JSON.stringify(false); var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open("GET", "http://{base_url}/tts/3/reports?limit=2"); xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); xhr.setRequestHeader("content-type", "application/json"); xhr.setRequestHeader("accept", "application/json"); xhr.send(data);

Response :

JSON :

HTTP/1.1 200 OK Content-Type: application/json { "results":[ { "bulkId":"80664c0c-e1ca-414d-806a-5caf146463df", "messageId":"bcfb828b-7df9-4e7b-8715-f34f5c61271a", "to":"38598111", "sentAt":"2015-02-12T09:58:20.323+0100", "doneAt":"2015-02-12T09:58:20.337+0100", "startTime": "2018-06-25T13:38:15.000+0000", "endTime": "2018-06-25T13:38:28.316+0000", "answerTime": "2018-06-25T13:38:25.000+0000", "duration":10, "fileDuration": 19.3, "mccMnc": "21901", "callbackData": "DLR callback data", "dtmfCodes":"1", "recordedAudioFileUrl":"/tts/3/files/bcfb828b-7df9-4e7b-8715-f34f5c61271a/38598111", "price":{ "pricePerSecond":0.01, "currency":"EUR" }, "status":{ "groupId":3, "groupName":"DELIVERED", "id":5, "name":"DELIVERED_TO_HANDSET", "description":"Message delivered to handset" }, "error":{ "groupId":0, "groupName":"OK", "id": 5000, "name": "VOICE_ANSWERED", "description": "Call answered by human", "permanent": true } }, { "bulkId":"08fe4407-c48f-4d4b-a2f4-9ff583c985b8", "messageId":"12db39c3-7822-4e72-a3ec-c87442c0ffc5", "to":"385981112", "sentAt":"2015-02-12T09:58:20.345+0100", "doneAt":"2015-02-12T09:58:20.350+0100", "duration":10, "mccMnc": "21901", "callbackData": "DLR callback data", "dtmfCodes":"1", "recordedAudioFileUrl":"/tts/3/files/12db39c3-7822-4e72-a3ec-c87442c0ffc5/385981112", "price":{ "pricePerSecond":0.01, "currency":"EUR" }, "status":{ "groupId":3, "groupName":"DELIVERED", "id":5, "name":"DELIVERED_TO_HANDSET", "description":"Message delivered to handset" }, "error":{ "groupId":0, "groupName":"OK", "id": 5000, "name": "VOICE_ANSWERED", "description": "Call answered by human", "permanent": true } } ] }

XML :

HTTP/1.1 200 OK Content-Type: application/xml <reportResponse> <results> <result> <bulkId>80664c0c-e1ca-414d-806a-5caf146463df</bulkId> <messageId>bcfb828b-7df9-4e7b-8715-f34f5c61271a</messageId> <to>38598111</to> <sentAt>2015-02-12T09:58:20.323+0100</sentAt> <doneAt>2015-02-12T09:58:20.337+0100</doneAt> <duration>10</duration> <mccMnc>21901</mccMnc> <dtmfCodes>1</dtmfCodes> <recordedAudioFileUrl>https://{base_url}/tts/3/files/bcfb828b-7df9-4e7b-8715-f34f5c61271a/38598111</recordedAudioFileUrl> <price> <pricePerMessage>0.01</pricePerMessage> <currency>EUR</currency> </price> <status> <groupId>3</groupId> <groupName>DELIVERED</groupName> <id>5</id> <name>DELIVERED_TO_HANDSET</name> <description>Message delivered to handset</description> </status> <error> <groupId>0</groupId> <groupName>OK</groupName> <id>5000</id> <name>VOICE_ANSWERED</name> <description>Call answered by human</description> <permanent>true</permanent> </error> </result> <result> <bulkId>08fe4407-c48f-4d4b-a2f4-9ff583c985b8</bulkId> <messageId>12db39c3-7822-4e72-a3ec-c87442c0ffc5</messageId> <to>385981112</to> <sentAt>2015-02-12T09:58:20.345+0100</sentAt> <doneAt>2015-02-12T09:58:20.350+0100</doneAt> <duration>10</duration> <mccMnc>21901</mccMnc> <dtmfCodes>1</dtmfCodes> <recordedAudioFileUrl>https://{base_url}/tts/3/files/12db39c3-7822-4e72-a3ec-c87442c0ffc5/385981112</recordedAudioFileUrl> <price> <pricePerMessage>0.01</pricePerMessage> <currency>EUR</currency> </price> <status> <groupId>3</groupId> <groupName>DELIVERED</groupName> <id>5</id> <name>DELIVERED_TO_HANDSET</name> <description>Message delivered to handset</description> </status> <error> <groupId>0</groupId> <groupName>OK</groupName> <id>5000</id> <name>VOICE_ANSWERED</name> <description>Call answered by human</description> <permanent>true</permanent> </error> </result> </results>

Voice Message logs

Resource

https://{base_url}/tts/3/logs

Parameters

Property Name Type Description
from string Sender ID that can be numeric.
to string The message destination address.
bulkId string The ID which uniquely identifies the request.
messageId string The ID that uniquely identifies the message sent.
generalStatus string Sent voice message status group. Indicates whether the message has been successfully sent, not sent, delivered, not delivered, waiting for delivery or any other possible status.
sentSince datetime Lower the limit on the date and time of voice message sending.
sentUntil datetime The upper limit on the date and time of voice message sending.
limit int Maximal number of messages in the returned logs. Default value is 50.
mcc string Mobile country code.
mnc string Mobile network code.

Request Example

JSON

GET /tts/3/logs HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/json

Response

200 OK

{ "results":[ { "bulkId":"06479ba3-5977-47f6-9346-fee0369bc76b", "messageId":"1f21d8d7-f306-4f53-9f6e-eddfce9849ea", "to":"916666666666", "from":"919999999999", "text":"Test voice message.", "sentAt":"2015-02-23T17:40:31.773+0100", "doneAt":"2015-02-23T17:40:31.787+0100", "duration":10, "mccmnc":"22801", "price":{ "pricePerSecond":0.01, "currency":"EUR" }, "status":{ "groupId":3, "groupName":"DELIVERED", "id":5, "name":"DELIVERED_TO_HANDSET", "description":"Message delivered to handset" }, "error":{ "groupId":0, "groupName":"OK", "id": 5003, "name": "EC_VOICE_NO_ANSWER", "description": "User was notified, but did not answer call", "permanent": true } } ] }

IMPORTANT:
Voice logs are available for the last 48 hours!

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 the message without authorization, you will get a response with HTTP status code 401 Unauthorized.
If you use this method too many times in a short period of time, you will get the status code 429 Too Many Requests. This prevents misusing logs in cases where reports would be more appropriate. For more information about when to use logs, please see the documentation.

VoiceLogsResponse

Parameter Type Description
results VoiceLog Collection of logs.

VoiceLog

Parameter Type Description
bulkId String The ID that uniquely identifies the request.
messageId String The ID that uniquely identifies the message sent.
to String The message destination address.
from String Sender ID that can be alphanumeric or numeric.
text String Text of the message that was sent.
sentAt Date Tells when the voice message was sent. Has the following format: yyyy-MM-dd'T'HH:mm:ss.SSSZ.
doneAt Date Tells when the voice message was processed by Infobip (ie. delivered to destination, delivered to destination network, etc.)
duration int Call duration in seconds.
mccmnc String Mobile country and network codes.
price Price Sent voice message price.
status Status Indicates whether the message has been successfully sent, not sent, delivered, not delivered, waiting for delivery or any other possible status.
error Error Indicates whether the error occurred during the query execution.

Price

Parameter Type Description
pricePerMessage BigDecimal Price per one second of voice message.
currency String The currency in which the price is expressed.

Status

Parameter Type Description
groupId int Status group ID.
groupName String Status group name.
id int Status ID.
name String Status name.
description String Human-readable description of the status.

Error

Parameter Type Description
groupId int Error group ID.
groupName String Error group name.
id int Error ID.
name String Error name.
description String Human-readable description of the error.
permanent boolean Tells if the error is permanent.

Additional examples

Getting logs without any query parameter

This request will return the last 50 message logs from the previous 48h by default.

Request :

JSON :

GET /tts/3/logs HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/json

XML :

GET /tts/3/logs HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/xml

cURL :

curl -X GET -H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" -H "Content-Type: application/json" -H "Accept: application/json" "http://{base_url}/tts/3/logs"

PHP :

<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "http://{base_url}/tts/3/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==", "content-type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }

Ruby :

require 'uri' require 'net/http' url = URI("http://{base_url}/tts/3/logs") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Get.new(url) request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' request["content-type"] = 'application/json' request["accept"] = 'application/json' response = http.request(request) puts response.read_body

Python :

import http.client conn = http.client.HTTPConnection("{base_url}") payload = "" headers = { 'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", 'content-type': "application/json", 'accept': "application/json" } conn.request("GET", "/tts/3/logs", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))

Java :

HttpResponse<String> response = Unirest.get("http://{base_url}/tts/3/logs") .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==") .header("content-type", "application/json") .header("accept", "application/json") .asString();

C# :

var client = new RestClient("http://{base_url}/tts/3/logs"); var request = new RestRequest(Method.GET); request.AddHeader("accept", "application/json"); request.AddHeader("content-type", "application/json"); request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); IRestResponse response = client.Execute(request);

JavaScript :

var data = JSON.stringify(false); var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open("GET", "http://{base_url}/tts/3/logs"); xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); xhr.setRequestHeader("content-type", "application/json"); xhr.setRequestHeader("accept", "application/json"); xhr.send(data);

Response :

JSON

HTTP/1.1 200 OK Content-Type: application/json { "results":[ { "bulkId":"bafdeb3d-719b-4cce-8762-54d47b40f3c5", "messageId":"07e03aae-fabc-44ad-b1ce-222e14094d70", "to":"916666666666", "from":"919999999999", "text":"Test voice message 1.", "sentAt":"2015-02-23T17:41:11.833+0100", "doneAt":"2015-02-23T17:41:11.843+0100", "duration":10, "mccmnc":"22801", "price":{ "pricePerSecond":0.01, "currency":"EUR" }, "status":{ "groupId":3, "groupName":"DELIVERED", "id":5, "name":"DELIVERED_TO_HANDSET", "description":"Message delivered to handset" }, "error":{ "groupId":0, "groupName":"OK", "id": 5003, "name": "EC_VOICE_NO_ANSWER", "description": "User was notified, but did not answer call", "permanent": true } }, { "bulkId":"06479ba3-5977-47f6-9346-fee0369bc76b", "messageId":"1f21d8d7-f306-4f53-9f6e-eddfce9849ea", "to":"916666666666", "from":"919999999999", "text":"Test voice message 2.", "sentAt":"2015-02-23T17:40:31.773+0100", "doneAt":"2015-02-23T17:40:31.787+0100", "duration":10, "mccmnc":"22801", "price":{ "pricePerSecond":0.01, "currency":"EUR" }, "status":{ "groupId":3, "groupName":"DELIVERED", "id":5, "name":"DELIVERED_TO_HANDSET", "description":"Message delivered to handset" }, "error":{ "groupId":0, "groupName":"OK", "id": 5003, "name": "EC_VOICE_NO_ANSWER", "description": "User was notified, but did not answer call", "permanent": true } } ] }

XML

HTTP/1.1 200 OK Content-Type: application/xml <smsLogsResponse> <results> <result> <bulkId>7944c32d-bf77-4f41-a752-c3aa89027adc</bulkId> <messageId>f97d3b99-fab2-468e-8acf-c8c8792b8ce6</messageId> <to>916666666666</to> <from>InfoSMS</from> <text>Test SMS.</text> <sentAt>2015-02-23T17:41:18.020+0100</sentAt> <doneAt>2015-02-23T17:41:18.027+0100</doneAt> <duration>1</duration> <mccmnc>22801</mccmnc> <price> <pricePerMessage>0.0100</pricePerMessage> <currency>EUR</currency> </price> <status> <groupId>3</groupId> <groupName>DELIVERED</groupName> <id>5</id> <name>DELIVERED_TO_HANDSET</name> <description>Message delivered to handset</description> </status> <error> <groupId>0</groupId> <groupName>Ok</groupName> <id>5003</id> <name>EC_VOICE_NO_ANSWER</name> <description>User was notified, but did not answer call</description> <permanent>true</permanent> </error> </result> <result> <bulkId>bafdeb3d-719b-4cce-8762-54d47b40f3c5</bulkId> <messageId>07e03aae-fabc-44ad-b1ce-222e14094d70</messageId> <to>916666666666</to> <from>InfoSMS</from> <text>Test SMS.</text> <sentAt>2015-02-23T17:41:11.833+0100</sentAt> <doneAt>2015-02-23T17:41:11.843+0100</doneAt> <duration>1</duration> <mccmnc>22801</mccmnc> <price> <pricePerMessage>0.0100</pricePerMessage> <currency>EUR</currency> </price> <status> <groupId>3</groupId> <groupName>DELIVERED</groupName> <id>5</id> <name>DELIVERED_TO_HANDSET</name> <description>Message delivered to handset</description> </status> <error> <groupId>0</groupId> <groupName>Ok</groupName> <id>5003</id> <name>EC_VOICE_NO_ANSWER</name> <description>User was notified, but did not answer call</description> <permanent>true</permanent> </error> </result> </results> </smsLogsResponse>

Getting logs with from, to and limit as filters

This request will filter final messages according to the rule - all messages sent from from, return last limit messages with destinations to.

Request :

JSON :

GET /tts/3/logs?from=919999999999&to=916666666666&limit=1 HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/json

XML :

GET /tts/3/logs?from=919999999999&to=916666666666&limit=1 HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/xml

cURL :

curl -X GET \ -H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ "http://{base_url}/tts/3/logs?from=919999999999&to=916666666666&limit=1"

PHP :

<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "http://{base_url}/tts/3/logs?from=919999999999&to=916666666666&limit=1", 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==", "content-type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }

Ruby :

import http.client conn = http.client.HTTPConnection("{base_url}") payload = "" headers = { 'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", 'content-type': "application/json", 'accept': "application/json" } conn.request("GET", "/tts/3/logs?from=919999999999&to=916666666666&limit=1", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))

Python :

import http.client conn = http.client.HTTPConnection("{base_url}") payload = "" headers = { 'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", 'content-type': "application/json", 'accept': "application/json" } conn.request("GET", "/tts/3/logs?from=919999999999&to=916666666666&limit=1", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))

Java :

HttpResponse response = Unirest.get("http://{base_url}/tts/3/logs?from=919999999999&to=916666666666&limit=1") .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==") .header("content-type", "application/json") .header("accept", "application/json") .asString();

C# :

var client = new RestClient("http://{base_url}/tts/3/logs?from=919999999999&to=916666666666&limit=1"); var request = new RestRequest(Method.GET); request.AddHeader("accept", "application/json"); request.AddHeader("content-type", "application/json"); request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); IRestResponse response = client.Execute(request);

JavaScript :

var data = JSON.stringify(false); var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open("GET", "http://{base_url}/tts/3/logs?from=919999999999&to=916666666666&limit=1"); xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); xhr.setRequestHeader("content-type", "application/json"); xhr.setRequestHeader("accept", "application/json"); xhr.send(data);

Response :

JSON

HTTP/1.1 200 OK Content-Type: application/json { "results":[ { "bulkId":"bafdeb3d-719b-4cce-8762-54d47b40f3c5", "messageId":"07e03aae-fabc-44ad-b1ce-222e14094d70", "to":"916666666666", "from":"919999999999", "text":"Test voice message 1.", "sentAt":"2015-02-23T17:41:11.833+0100", "doneAt":"2015-02-23T17:41:11.843+0100", "duration":10, "mccmnc":"22801", "price":{ "pricePerSecond":0.01, "currency":"EUR" }, "status":{ "groupId":3, "groupName":"DELIVERED", "id":5, "name":"DELIVERED_TO_HANDSET", "description":"Message delivered to handset" }, "error":{ "groupId":0, "groupName":"OK", "id": 5003, "name": "EC_VOICE_NO_ANSWER", "description": "User was notified, but did not answer call", "permanent": true } } ] }

XML

HTTP/1.1 200 OK Content-Type: application/xml <smsLogsResponse> <results> <result> <bulkId>82d1d36e-e4fb-4194-8b93-caeb053bd327</bulkId> <messageId>fc0cbfb8-7a72-40da-a76d-e2c2d9400835</messageId> <to>916666666666</to> <from>InfoSMS</from> <text>Test SMS.</text> <sentAt>2015-02-23T17:42:05.390+0100</sentAt> <doneAt>2015-02-23T17:42:05.390+0100</doneAt> <duration>1</duration> <mccmnc>22801</mccmnc> <price> <pricePerMessage>0.0000</pricePerMessage> <currency>EUR</currency> </price> <status> <groupId>5</groupId> <groupName>REJECTED</groupName> <id>6</id> <name>REJECTED_NETWORK</name> <description>Network is forbidden</description> <action>Contact account manager</action> </status> <error> <groupId>0</groupId> <groupName>OK</groupName> <id>5003</id> <name>EC_VOICE_NO_ANSWER</name> <description>User was notified, but did not answer call</description> <permanent>true</permanent> </error> </result> </results> </smsLogsResponse>

Getting logs filtered by multiple bulkIds

This request will return messages that have bulkId among the specified bulkIds in the filter.

Request :

JSON :

GET /tts/3/logs?bulkId=1dece649-6c8f-404e-8c6e-c7e073be509a,bafdeb3d-719b-4cce-8762-54d47b40f3c5 HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/json

XML :

GET /tts/3/logs?bulkId=1dece649-6c8f-404e-8c6e-c7e073be509a,bafdeb3d-719b-4cce-8762-54d47b40f3c5 HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/xml

cURL :

curl -X GET -H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" -H "Content-Type: application/json" -H "Accept: application/json" "http://{base_url}/tts/3/logs?bulkId=1dece649-6c8f-404e-8c6e-c7e073be509a,bafdeb3d-719b-4cce-8762-54d47b40f3c5"

PHP :

<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "http://{base_url}/tts/3/logs?bulkId=1dece649-6c8f-404e-8c6e-c7e073be509a%2Cbafdeb3d-719b-4cce-8762-54d47b40f3c5", 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==", "content-type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }

Ruby :

require 'uri' require 'net/http' url = URI("http://{base_url}/tts/3/logs?bulkId=1dece649-6c8f-404e-8c6e-c7e073be509a%2Cbafdeb3d-719b-4cce-8762-54d47b40f3c5") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Get.new(url) request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' request["content-type"] = 'application/json' request["accept"] = 'application/json' response = http.request(request) puts response.read_body

Python :

import http.client conn = http.client.HTTPConnection("{base_url}") payload = "" headers = { 'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", 'content-type': "application/json", 'accept': "application/json" } conn.request("GET", "/tts/3/logs?bulkId=1dece649-6c8f-404e-8c6e-c7e073be509a%2Cbafdeb3d-719b-4cce-8762-54d47b40f3c5", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))

Java :

HttpResponse response = Unirest.get("http://{base_url}/tts/3/logs?bulkId=1dece649-6c8f-404e-8c6e-c7e073be509a%2Cbafdeb3d-719b-4cce-8762-54d47b40f3c5") .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==") .header("content-type", "application/json") .header("accept", "application/json") .asString();

C# :

var client = new RestClient("http://{base_url}/tts/3/logs?bulkId=1dece649-6c8f-404e-8c6e-c7e073be509a%2Cbafdeb3d-719b-4cce-8762-54d47b40f3c5"); var request = new RestRequest(Method.GET); request.AddHeader("accept", "application/json"); request.AddHeader("content-type", "application/json"); request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); IRestResponse response = client.Execute(request);

JavaScript :

var data = JSON.stringify(false); var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open("GET", "http://{base_url}/tts/3/logs?bulkId=1dece649-6c8f-404e-8c6e-c7e073be509a%2Cbafdeb3d-719b-4cce-8762-54d47b40f3c5"); xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); xhr.setRequestHeader("content-type", "application/json"); xhr.setRequestHeader("accept", "application/json"); xhr.send(data);

Response :

JSON

HTTP/1.1 200 OK Content-Type: application/json { "results":[ { "bulkId":"bafdeb3d-719b-4cce-8762-54d47b40f3c5", "messageId":"07e03aae-fabc-44ad-b1ce-222e14094d70", "to":"916666666666", "from":"919999999999", "text":"Test voice message 1.", "sentAt":"2015-02-23T17:41:11.833+0100", "doneAt":"2015-02-23T17:41:11.843+0100", "duration":10, "mccmnc":"22801", "price":{ "pricePerSecond":0.01, "currency":"EUR" }, "status":{ "groupId":3, "groupName":"DELIVERED", "id":5, "name":"DELIVERED_TO_HANDSET", "description":"Message delivered to handset" }, "error":{ "groupId":0, "groupName":"OK", "id": 5003, "name": "EC_VOICE_NO_ANSWER", "description": "User was notified, but did not answer call", "permanent": true } }, { "bulkId":"06479ba3-5977-47f6-9346-fee0369bc76b", "messageId":"1f21d8d7-f306-4f53-9f6e-eddfce9849ea", "to":"916666666666", "from":"919999999999", "text":"Test voice message 2.", "sentAt":"2015-02-23T17:40:31.773+0100", "doneAt":"2015-02-23T17:40:31.787+0100", "duration":10, "mccmnc":"22801", "price":{ "pricePerSecond":0.01, "currency":"EUR" }, "status":{ "groupId":3, "groupName":"DELIVERED", "id":5, "name":"DELIVERED_TO_HANDSET", "description":"Message delivered to handset" }, "error":{ "groupId":0, "groupName":"OK", "id": 5003, "name": "EC_VOICE_NO_ANSWER", "description": "User was notified, but did not answer call", "permanent": true } } ] }

XML

HTTP/1.1 200 OK Content-Type: application/xml <smsLogsResponse> <results> <result> <bulkId>bafdeb3d-719b-4cce-8762-54d47b40f3c5</bulkId> <messageId>07e03aae-fabc-44ad-b1ce-222e14094d70</messageId> <to>916666666666</to> <from>InfoSMS</from> <text>Test SMS.</text> <sentAt>2015-02-23T17:41:11.833+0100</sentAt> <doneAt>2015-02-23T17:41:11.843+0100</doneAt> <duration>1</duration> <mccmnc>22801</mccmnc> <price> <pricePerMessage>0.0100</pricePerMessage> <currency>EUR</currency> </price> <status> <groupId>3</groupId> <groupName>DELIVERED</groupName> <id>5</id> <name>DELIVERED_TO_HANDSET</name> <description>Message delivered to handset</description> </status> <error> <groupId>0</groupId> <groupName>OK</groupName> <id>5003</id> <name>EC_VOICE_NO_ANSWER</name> <description>User was notified, but did not answer call</description> <permanent>true</permanent> </error> </result> <result> <bulkId>1dece649-6c8f-404e-8c6e-c7e073be509a</bulkId> <messageId>faa48fe6-fe2c-4f36-a43b-a070e2906ecb</messageId> <to>916666666666</to> <from>InfoSMS</from> <text>Test SMS.</text> <sentAt>2015-02-23T16:22:37.413+0100</sentAt> <doneAt>2015-02-23T16:22:37.437+0100</doneAt> <duration>1</duration> <mccmnc>22801</mccmnc> <price> <pricePerMessage>0.0000</pricePerMessage> <currency>EUR</currency> </price> <status> <groupId>2</groupId> <groupName>UNDELIVERABLE</groupName> <id>9</id> <name>UNDELIVERABLE_NOT_DELIVERED</name> <description>Message sent not delivered</description> </status> <error> <groupId>0</groupId> <groupName>OK</groupName> <id>5003</id> <name>EC_VOICE_NO_ANSWER</name> <description>User was notified, but did not answer call</description> <permanent>true</permanent> </error> </result> </results> </smsLogsResponse>

Getting logs filtered by date range and general status

This request will return messages with the status that matches the generalStatus parameter (see Response codes) which are sent between sentSince and current time.

Request :

JSON :

GET /tts/3/logs?sentSince=2015-02-22T17:42:05.390%2b01:00&generalStatus=DELIVERED HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/json

XML :

GET /tts/3/logs?sentSince=2015-02-22T17:42:05.390%2b01:00&generalStatus=DELIVERED HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Accept: application/xml

cURL :

curl -X GET -H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" -H "Content-Type: application/json" -H "Accept: application/json" "http://{base_url}/tts/3/logs?sentSince=2015-02-22T17:42:05.390%252b01:00&generalStatus=DELIVERED"

PHP :

<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "http://{base_url}/tts/3/logs?sentSince=2015-02-22T17%3A42%3A05.390%252b01%3A00&generalStatus=DELIVERED", 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==", "content-type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }

Ruby :

require 'uri' require 'net/http' url = URI("http://{base_url}/tts/3/logs?sentSince=2015-02-22T17%3A42%3A05.390%252b01%3A00&generalStatus=DELIVERED") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Get.new(url) request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' request["content-type"] = 'application/json' request["accept"] = 'application/json' response = http.request(request) puts response.read_body

Python :

import http.client conn = http.client.HTTPConnection("{base_url}") payload = "" headers = { 'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", 'content-type': "application/json", 'accept': "application/json" } conn.request("GET", "/tts/3/logs?sentSince=2015-02-22T17%3A42%3A05.390%252b01%3A00&generalStatus=DELIVERED", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))

Java :

HttpResponse response = Unirest.get("http://{base_url}/tts/3/logs?sentSince=2015-02-22T17%3A42%3A05.390%252b01%3A00&generalStatus=DELIVERED") .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==") .header("content-type", "application/json") .header("accept", "application/json") .asString();

C# :

var client = new RestClient("http://{base_url}/tts/3/logs?sentSince=2015-02-22T17%3A42%3A05.390%252b01%3A00&generalStatus=DELIVERED"); var request = new RestRequest(Method.GET); request.AddHeader("accept", "application/json"); request.AddHeader("content-type", "application/json"); request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); IRestResponse response = client.Execute(request);

JavaScript :

var data = JSON.stringify(false); var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open("GET", "http://{base_url}/tts/3/logs?sentSince=2015-02-22T17%3A42%3A05.390%252b01%3A00&generalStatus=DELIVERED"); xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); xhr.setRequestHeader("content-type", "application/json"); xhr.setRequestHeader("accept", "application/json"); xhr.send(data);

Response :

JSON

HTTP/1.1 200 OK Content-Type: application/json { "results":[ { "bulkId":"bafdeb3d-719b-4cce-8762-54d47b40f3c5", "messageId":"07e03aae-fabc-44ad-b1ce-222e14094d70", "to":"916666666666", "from":"919999999999", "text":"Test voice message 1.", "sentAt":"2015-02-23T17:41:11.833+0100", "doneAt":"2015-02-23T17:41:11.843+0100", "duration":10, "mccmnc":"22801", "price":{ "pricePerSecond":0.01, "currency":"EUR" }, "status":{ "groupId":3, "groupName":"DELIVERED", "id":5, "name":"DELIVERED_TO_HANDSET", "description":"Message delivered to handset" }, "error":{ "groupId":0, "groupName":"OK", "id": 5003, "name": "EC_VOICE_NO_ANSWER", "description": "User was notified, but did not answer call", "permanent": true } } ] }

XML

HTTP/1.1 200 OK Content-Type: application/xml <smsLogsResponse> <results> <result> <bulkId>ce166d0e-bac7-4639-a094-52c406852afd</bulkId> <messageId>fdf71ada-3308-4cd1-9962-31f2b937a1d0</messageId> <to>916666666666</to> <from>InfoSMS</from> <text>Test SMS.</text> <sentAt>2015-02-24T10:34:56.463+0100</sentAt> <doneAt>2015-02-24T10:34:56.480+0100</doneAt> <duration>1</duration> <mccmnc>22801</mccmnc> <price> <pricePerMessage>0.0100</pricePerMessage> <currency>EUR</currency> </price> <status> <groupId>3</groupId> <groupName>DELIVERED</groupName> <id>5</id> <name>DELIVERED_TO_HANDSET</name> <description>Message delivered to handset</description> </status> <error> <groupId>0</groupId> <groupName>OK</groupName> <id>5003</id> <name>EC_VOICE_NO_ANSWER</name> <description>User was notified, but did not answer call</description> <permanent>true</permanent> </error> </result> </results> </smsLogsResponse>

Get Voices

Resource

https://{base_url}/tts/3/voices/{language}

Property Name Type Description
language string Language abbreviation. (e.g. "en"). In the Languages section, you can find the list of supported languages.

Response for /tts/3/voices/en

JSON

{ "voices": [ { "name": "Benjamin", "gender": "male" }, { "name": "Ivy", "gender": "female" }, { "name": "Joanna", "gender": "female" }, { "name": "Joey", "gender": "male" }, { "name": "Justin", "gender": "male" }, { "name": "Kendra", "gender": "female" }, { "name": "Kimberly", "gender": "female" }, { "name": "Matthew", "gender": "male" }, { "name": "Salli", "gender": "female" }, { "name": "Zira", "gender": "female" } ] }

Bad request example:

JSON

GET {base_url}/tts/3/voices/ba

Response :

JSON

{ "requestError": { "serviceException": { "messageId": "1562683169314536019", "text": "No voices are found for language: ba" } } }

Voice Messages Schedule Information and Status

Fully featured voice messages API allows you to send advanced voice messages that will not be sent immediately, but at a scheduled time (scheduled voice messages) by setting the sendAt parameter.

Using Sending speed on Fully featured voice messages also results with the campaign being scheduled. This means that the messages will not be sent as the bulk immediately all at once but rather as a scheduled campaign, with some delay between the messages depending on the sending speed being used. Message scheduling and status API enables you to control message delivery schedule and message status.

Message scheduling:

Get message schedule info
Reschedule voice message

Message status:

Get message status info
Update message status

Get message schedule info

GET http://{base_url}/tts/3/bulks?bulkId={bulkId}

This method will return information about the scheduled time for a unique bulk message. Canceling and rescheduling are supported only when the Fully featured voice message request contains at least one message and the message bulkId is unique.

Request example:

JSON

GET /tts/3/bulks?bulkId=0e655fe9-6581-4812-87f5-a3cfed8d78ae HTTP/1.1 Host: {base_url} Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Content-Type: application/json

Response:

JSON

{ "bulkId": "0e655fe9-6581-4812-87f5-a3cfed8d78ae", "sendAt": "2018-07-07T16:00:00.000+0000" }

Reschedule voice message

PUT http://{base_url}/tts/3/bulks?bulkId={bulkId}

Messages scheduled with the sendAt or Sending speed parameter can be paused, resumed or canceled by changing the message status, or rescheduled using the bulkId parameter as an identifier.

RESCHEDULING AND STATUS UPDATE REQUIREMENTS

Please note that canceling and rescheduling is supported only when the Fully featured voice message request contains at least one message per bulk and the message bulkId is unique. If you don't provide the bulkId through the initial voice message request, the system will create a unique id for you and include it as bulkId in response. This ID can be used later to retrieve delivery information, change status and date/time of message delivery.

Request example:

JSON

PUT /tts/3/bulks?bulkId=0e655fe9-6581-4812-87f5-a3cfed8d78ae HTTP/1.1 Host: {base_url} Content-Type: application/json Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== { "sendAt": "2018-07-15T16:00:00.000+0000" }

Response:

JSON

{ "bulkId": "0e655fe9-6581-4812-87f5-a3cfed8d78ae", "sendAt": "2018-07-15T16:00:00.000+0000" }

Get message status info

GET http://{base_url}/tts/3/bulks/status?bulkId={bulkId}

This method will return the status of the bulk message.

Request example:

JSON

GET /tts/3/bulks/status?bulkId=0e655fe9-6581-4812-87f5-a3cfed8d78ae HTTP/1.1 Host: {base_url} Content-Type: application/json Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

Response:

JSON

{ "bulkId": "0e655fe9-6581-4812-87f5-a3cfed8d78ae", "status": "PENDING" }
Possible status to be returned Meaning of the status
PENDING Sending will start in a scheduled time
PAUSED Sending is paused
CANCELED Sending was canceled
PROCESSING Sending in the progress
FINISHED All the messages were sent

Update message status

PUT http://{base_url}/tts/3/bulks/status?bulkId={bulkId}

Messages scheduled with the sendAt or sending speed parameter can be paused, resumed or canceled by changing the message status, or rescheduled using the bulkId parameter as an identifier.
Only voice messages that were not already sent will be canceled.

RESCHEDULING AND STATUS UPDATE REQUIREMENTS

Please note that cancelling and rescheduling is supported only when the Fully featured voice message request contains only one message per bulk and the message bulkId is unique. If you don't provide the bulkId through the initial advanced voice message send request, the system will create a unique id for you and include it as bulkId in response. This ID can be used later to retrieve delivery information, change status and date/time of message delivery.

STATUS UPDATE

PENDING and PAUSED statuses can be changed back and forth until the message starts to process (scheduled time is up, and the message is sent). Once a message is CANCELED, it cannot be rescheduled or updated with a new status! The message will remain undelivered regardless of the scheduled date and time.

Request example:

JSON

PUT /tts/3/bulks/status?bulkId=0e655fe9-6581-4812-87f5-a3cfed8d78ae HTTP/1.1 Host: {base_url} Content-Type: application/json Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== { "status": "PAUSED" }

Response:

JSON

{ "bulkId": "0e655fe9-6581-4812-87f5-a3cfed8d78ae", "status": "PAUSED" }

PHP

<?php
  $apikey = "YourAPIkey";
  $apisender = "TESTIN";
  $msg ="YOUR MESSAGE HERE";
  $num = 91XXXXXXXXX; // MULTIPLE NUMBER VARIABLE PUT HERE...!
  $ms = rawurlencode($msg); //This for encode your message content
  $url = 'https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey='.$apikey.'&senderid='.$apisender.'&channel=2&DCS=0&flashsms=0&number='.$num.'&text='.$ms.'&route=1';
  //echo $url;
  $ch=curl_init($url);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch,CURLOPT_POST,1);
  curl_setopt($ch,CURLOPT_POSTFIELDS,"");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER,2);
  $data = curl_exec($ch);
  echo '

';
  print($data); /* result of API call*/
?>

C#

using System
using System
using System.IO
using System.Net
using System.Text
using System.Web

string sAPIKey = "YOUR API KEY HERE";
string sSenderID = "APPROVED SENDER ID";
string sChannel = "MESSAGE CHANNEL";
string sDCS = "0";
string sFlashsms = "0";
string sNumber = Session["Mobile"].ToString(); ' Enter your mobile number (static / dynamic)
string sMessage = "Enter Your Message or Message Variable";

string sURL = "https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=" + sAPIKEY + "&senderid=" + sSenderID + "&channel=" + sChannel + "&DCS=" + sDCS + "&flashsms="+ sFlashsms +"&number="+ sNumber +"&text="+ sMessage +"&route=1";

string sResponse = GetResponse(sURL);

Response.Write(sResponse);

public static string GetResponse(string sURL)

{

  HttpWebRequest request = (HttpWebRequest)WebRequest.Create(sURL);

  request.MaximumAutomaticRedirections = 4;

  request.Credentials = CredentialCache.DefaultCredentials;

  try{

   HttpWebResponse response = (HttpWebResponse)request.GetResponse();

   Stream receiveStream = response.GetResponseStream();

   StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);

   string sResponse = readStream.ReadToEnd();

   response.Close();

   readStream.Close();

  return sResponse;

  }
  catch{
   return "";
  }
}

C

CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx&text=test message&route=1");
CURLcode ret = curl_easy_perform(hnd);

VB.Net

'VB6 SMS API integration code

Private Sub Command1_Click()
    Dim DataToSend As String
    Dim objXML As Object
    Dim apikey As String
    Dim senderid As String
    Dim channel As String
    Dim DCS As String
    Dim flashsms As String
    Dim mobiles As String
    Dim message As String
    Dim route As String
    Dim URL As String

'Set these variables
'//Your authentication key
apikey = "Your Apikey";

'//Approved sender id(6 characters string only).
senderid = "TESTIN";

'//Message channel Promotional=1 or Transactional=2.
channel = "2";

'//Default is 0 for normal message, Set 8 for unicode sms.
flashsms = "0";

'//Recipient mobile number (pass with comma seprated if need to send on more then one number).
mobiles = "9999999999";

'//message
message = "TEST MESSAGE";

'//Define route
route = "DEFAULT";

' this url encode function may not work fully functional.
message = URLEncode(" Your message ")

'Define route
route = "default"
'do not use https
URL = "https://www.smsgatewayhub.com/api/mt/SendSMS?"

Set objXML = CreateObject("Microsoft.XMLHTTP")
objXML.Open "POST", URL , False
objXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

objXML.send "authkey=" + authKey + "&mobiles=" + mobiles + "&message=" + message + "&sender=" + sender + "&route=" + route
 If Len(objXML.responseText) > 0 Then
        MsgBox objXML.responseText

 End If

End Sub

Function URLEncode(ByVal Text As String) As String
    Dim i As Integer
    Dim acode As Integer
    Dim char As String

    URLEncode = Text

    For i = Len(URLEncode) To 1 Step -1
        acode = Asc(Mid$(URLEncode, i, 1))
        Select Case acode
            Case 48 To 57, 65 To 90, 97 To 122
                ' don't touch alphanumeric chars
            Case 32
                ' replace space with "+"
                Mid$(URLEncode, i, 1) = "+"
            Case Else
                ' replace punctuation chars with "%hex"
                URLEncode = Left$(URLEncode, i - 1) & "%" & Hex$(acode) & Mid$ _
                    (URLEncode, i + 1)
        End Select
    Next

End Function

Java

import java.net.*;

public class Java_example_httprequest {

public static void main(String[] args) {
try {
String apikey = "YOURAPIKEY";
String senderid = "TESTIN";
String channel = "";
String DCS = "0";
String flashsms = "0";
String mobile = "91xxxxxxxx";
String message = "hello this is testing message";
String route = "";

https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=YOURAPIKEY&senderid=YOURSENDERID&channel=2&DCS=0&flashsms=0&number=91XXXXX&text=hello%20this%20is%20testing%20message&route=


String requestUrl = "https://www.smsgatewayhub.com/api/mt/SendSMS?" +
"APIKey=" + URLEncoder.encode(apikey, "UTF-8") +
"&senderid=" + URLEncoder.encode(senderid, "UTF-8") +
"&channel=" + URLEncoder.encode(channel, "UTF-8") +
"&DCS=" + URLEncoder.encode(DCS, "UTF-8") +
"&flashsms=" + URLEncoder.encode(flashsms, "UTF-8") +
"&number=" + URLEncoder.encode(mobile, "UTF-8") +
"&text=" + URLEncoder.encode(message, "UTF-8") +
"&route=" + URLEncoder.encode(route, "UTF-8");



URL url = new URL(requestUrl);
HttpURLConnection uc = (HttpURLConnection)url.openConnection();

System.out.println(uc.getResponseMessage());

uc.disconnect();

} catch(Exception ex) {
System.out.println(ex.getMessage());
}
}

}

Ruby

require 'uri'
require 'net/http'
url = URI("https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number =91989xxxxxxx&text=test-message&route=1")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body

Shell

curl --request GET \
--url 'https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number =91989xxxxxxx&text=test-message&route=1

×
x
By continuing to use this site you consent to the use of cookies in accordance with our cookie policy.