With our REST, easy, and smart “SMS” APIs we allow you to integrate SMS at your app and get started in seconds, With Taqnyat, building a solution with SMS capabilities never been easier, a few lines of code will enable the SMS to create a magnificent app fit with your business needs.
In the below guide, we'll walk you through and explain how Taqnyat SMS API work:
Connecting to taqnyat.sa API is simple & easy, you can do it using HTML forms, which will send the data as POST, or send data to API URL directly using Query String, which will send the data as "GET". If you want to send a large amount of data, we recommend that you use the first method, which is POST; because the second method GET does not support sending a large amount of data. Besides, you can send data in JSON, a full description of the JSON Data method will be in this document.
taqnyat.sa also returns the data in the most common format, which is JSON.
When you connect to taqnyat.sa API through HTTP/HTTPS protocols, the SMS data must be in a certain format as follows: Sender Name must be encoded using URL-Encoding and message text must be in UTF-8 encodings:
https://api.taqnyat.sa/
To use our API, you will need a unique Bearer token generated from your account at our platform by following the below steps Setup Bearer token
For REST API Bearer token must be submitted withen the header Authorization
.
With Taqnyat you can set up your bearer token in seconds using the below steps:
To use taqnyat.sa API, you should have a taqnyat.sa account, here is an explanation of how you can register, checking your current balance, request a recharge for your balance through a “request recharge form” in taqnyat.sa website.
Registration process: You can register on taqnyat.sa website through the following link: Contact and go to Sales tab ,fill the form and hit send.
Check your balance: You can check your current balance from the website after you logged at the dashboard.
Balance Topup: After your login to your https://www.taqnyat.sa account, you can request recharging your balance, through the request top-up form, you can access it through the balance top-up tab located in the left top corner. Fill all the required data in the form and we will top up your account within two hours at most after we validate the deposit.
Using bearer Tokens: bearer Tokens will have a unique value generated in the taqnyat.sa user account , because it provides a more secure connection with the API.
Setup API settings: taqnyat.sa provides security settings that allows you to control SMS sending through API. You can enable or disable sending SMS through API from your account, grant permission to specific IP’s to be allowed to send SMS message through API using your account, and grant permission to specific countries to be allowed to send SMS message through API using your account.
System resources are used to retrieve info about the system.
This method used to retrieve status for one or multiple services in the system. Authorization is not required .
Here are some examples of HTTP API:
https://api.taqnyat.sa/system/status
if the request submitted successfully header status of 200 will be return as follows:
{
statusCode: 200,
status: {
service: "none",
description: "All Services are Operational"
}
}
if the request return header 405 , you are using RESTFull API and have used unauthorized method for example if the System resource allow only get , and you used post error 405 expected to return.
{
"statusCode": 405,
"message": "Method Not Allowed"
}
Voices resources are used to deal with voice.
This resource used to send voice(s) from your account.
Authorization is required .
Parameter | Description | Required |
---|---|---|
audioUrl | full path for your voice | Yes |
callerId | sender name as international format without 00 or symbol (+) | Yes |
recipients | Array of international format without 00 or symbol (+) | Yes |
Here is some example of HTTP API:
https://api.taqnyat.sa/voiceSend.php
bearerTokens=xxxxxxxxxxxxxxxxxxxxxxxxxx&
audioUrl=https://your_domain.com/your_mp3_file.mp3&
callerId=966500000000&
recipients=966500000000,966500000000&
if the request submitted successfully header status of 201 will be return as follows:
{
"status": 1,
"ResponseStatus": success,
"messageId": 5452899970,
"Data": {
"msgId": "V-8",
"result": "1",
"MessageAr": "تم الارسال",
"MessageEn": "sent successfully",
"duration": 3,
"dtmfTimeout": "0",
"connectionFee": 3,
"price": "0.216",
"rejectedNumber": "[]",
"Error": "null",
}
}
if the request return ErrorCode 2
{
"status": 1,
"ResponseStatus": fail,
"Data": null,
"Error": {
"ErrorCode": 2,
"MessageAr": "الرصيد = 0",
"MessageEn": "Your balance is 0",
}
}
if the request return ErrorCode 3
{
"status": 1,
"ResponseStatus": fail,
"Data": null,
"Error": {
"ErrorCode": 3,
"MessageAr": "الرصيد غير كافي",
"MessageEn": "Your balance is not enough",
}
}
if the request return ErrorCode 14
{
"status": 1,
"ResponseStatus": fail,
"Data": null,
"Error": {
"ErrorCode": 14,
"MessageAr": "هوية المتصل غير صحيحة",
"MessageEn": "Invalid CallerId",
}
}
if the request return ErrorCode 15
{
"status": 1,
"ResponseStatus": fail,
"Data": null,
"Error": {
"ErrorCode": 15,
"MessageAr": "الأرقام المرسل لها غير صحيحة أو فارغة",
"MessageEn": "Mobile(s) number(s) is not specified or incorrect",
}
}
if the request return ErrorCode 17
{
"status": 1,
"ResponseStatus": fail,
"Data": null,
"Error": {
"ErrorCode": 17,
"MessageAr": "يوجد خطأ في الارسال او الملف الصوتي",
"MessageEn": "error msg or error audio file",
}
}
if the request return ErrorCode 101
{
"status": 1,
"ResponseStatus": fail,
"Data": null,
"Error": {
"ErrorCode": 101,
"MessageAr": "الارسال باستخدام بوابات الارسال معطل",
"MessageEn": "sending by API is disabled",
}
}
if the request return ErrorCode 102
{
"status": 1,
"ResponseStatus": fail,
"Data": null,
"Error": {
"ErrorCode": 102,
"MessageAr": "هذا الاي بي 10.0.0.1 غير مصرح له ",
"MessageEn": "MessageEn":" this ip 10.0.0.1 Not authorized to using the API",
}
}
if the request return ErrorCode 104 , you are using wrong bearer Tokens make sure to follow the steps in above to setup your bearer Token Setup Bearer token
{
"status": 1,
"ResponseStatus": fail,
"Data": null,
"Error": {
"ErrorCode": 104,
"MessageAr": "مفتاح الارسال غير صحيح",
"MessageEn": "Invalid Bearer Tokens",
}
}
if the request return header 400 , its mean the request has not submitted successfully and the error code in the response will explain the issue you can scroll down to the error list to understand what type of error you have.
Below on the table list for code in the response , if the header returned 400 . lookup the code of the response with code on the table for better understanding the error cause.
number | Error | Description |
---|---|---|
2 | Your balance is 0 | Your balance has been consumed and you need to top up your account to restore the ability to send Voice again. |
3 | Your balance is not enough | Your account has a low balance and does not cover all Voices you are about to send. |
14 | Invalid CallerId | Sender phone used is not correct, make sure to include the sender phone as international format without 00 or symbol (+) |
15 | Mobile(s) number(s) is not specified or incorrect | Resivers phones used is not correct, make sure to include the Resivers phones as Array of international format without 00 or symbol (+) |
17 | error msg or error audio file | your audio file is not correct, make sure to include the correct path and the correct file type |
101 | sending by API is disabled | the functionality or capability to send data or requests through an API has been deactivated or turned off |
102 | this ip 10.0.0.1 Not authorized to using the API | the IP address from which you are attempting to access an API service is not granted permission or authorization to do so. |
104 | Invalid Bearer Tokens | the API key you are using to authenticate or authorize your access to the API service is either missing, incorrect, expired, or revoked. |