برای خرید سامانه پیامک همین الان در پیامک آموت ثبت نام کنید
نام | نوع | توضیحات |
---|---|---|
Token | String الزامی | توکن ثبت شده در سامانه پیامک آموت |
SendDateTime | Object الزامی | زمان ارسال پیامک |
SMSMessageText | String الزامی | متن پیامک |
LineNumber | String الزامی | شماره خط |
Mobiles | Object الزامی | لیست موبایل های دریافت کنندگان پیامک |
نام | نوع | توضیحات |
---|---|---|
ReturnValue | Object | result.Data شامل آرایه ای از یک کلاس با مقادیر { Status = وضعیت , MessageID = کد پیامک (کد شماره کمپین) , Mobile = شماره موبایل } |
string Token = "MyToken";
DateTime SendDateTime = DateTime.Now;
string SMSMessageText = "پیامک تستی من";
string LineNumber = "public";
string[] Mobiles = new string[]
{
"9120000000",
"9150000000",
};
using (var client = new System.Net.WebClient())
{
client.Headers.Add(System.Net.HttpRequestHeader.Authorization, Token);
var data = new System.Collections.Specialized.NameValueCollection()
{
{ "SendDateTime", SendDateTime.ToString() },
{ "SMSMessageText", SMSMessageText },
{ "LineNumber", LineNumber },
{ "Mobiles", string.Join(",",Mobiles) },
};
byte[] bytes = client.UploadValues("https://portal.amootsms.com/rest/SendSimple", data);
string json = System.Text.UTF8Encoding.UTF8.GetString(bytes);//خروجی
}
//result.Data => {Status,MessageID,Mobile},{Status,MessageID,Mobile},....
$url = "https://portal.amootsms.com/rest/SendSimple";
$url = $url."?"."Token=".urlencode("MyToken");
$nowIran = new DateTime('now', new DateTimeZone('IRAN'));
$url = $url."&"."SendDateTime=".urlencode($nowIran->format('c'));
$url = $url."&"."SMSMessageText=".urlencode("پیامک تستی من");
$url = $url."&"."LineNumber=public";
$url = $url."&"."Mobiles=9120000000,9150000000";
$json = file_get_contents($url);
echo $json;
//$result = json_decode($json);
//echo $result->Status;
///////////// Method GET =>
const https = require('https');
var url = 'https://portal.amootsms.com/rest/SendSimple';
url += '?Token='+encodeURIComponent('MyToken');
url += '&SendDateTime=2020-01-01 12:00:00';
url += '&SMSMessageText='+encodeURIComponent('تست');
url += '&LineNumber=public';
url += '&Mobiles=09159999999,09129999999';
https.get(url, (resp) => {
let data = '';
// A chunk of data has been received.
resp.on('data', (chunk) => {
data += chunk;
});
// The whole response has been received. Print out the result.
resp.on('end', () => {
console.log(JSON.parse(data).explanation);
});
}).on("error", (err) => {
console.log("Error: " + err.message);
});
/////////// Method POST =>
const https = require('https');
var postData = JSON.stringify({
'Token': 'MyToken',
'SendDateTime': '2020-01-01 12:00:00',
'SMSMessageText': 'تست',
'LineNumber': 'public',
'Mobiles': '09159999999,09129999999'
});
var options = {
hostname: 'portal.amootsms.com',
port: 443,
path: '/rest/SendSimple',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': postData.length
}
};
var req = https.request(options, (resp) => {
console.log('statusCode:', resp.statusCode);
console.log('headers:', resp.headers);
let data = '';
// A chunk of data has been received.
resp.on('data', (chunk) => {
data += chunk;
});
// The whole response has been received. Print out the result.
resp.on('end', () => {
console.log(JSON.parse(data).explanation);
});
});
req.on('error', (e) => {
console.error(e);
});
req.write(postData);
req.end();
Status | Title |
---|---|
0 | Failed |
1 | Success |
2 | AccountIsDemo |
4 | CreditNotEnough |
5 | LineNumber_NotExist |
6 | BackupLineNumber_NotExist |
7 | Avanak_NotAvailable |
10 | UserName_Empty |
11 | Password_Empty |
12 | LineNumber_Empty |
13 | BackupLineNumber_Empty |
14 | SMSMessageText_Empty |
15 | AvanakMessageText_Empty |
16 | Mobile_Empty |
17 | Mobiles_Empty |
18 | Title_Empty |
19 | FirstNameOrLastName_Empty |
20 | URLAddress_Empty |
100 | UserNameOrPassword_Invalid |
101 | Mobile_Invalid |
102 | Mobiles_Invalid |
103 | Count_Invalid |
104 | FromRow_Invalid |
105 | FromDate_Invalid |
106 | FromDateTime_Invalid |
107 | ToDate_Invalid |
108 | ToDateTime_Invalid |
109 | FromDateIsAfterThanToDate |
110 | FromDateTimeIsAfterThanToDateTime |
111 | MessageID_Invalid |
112 | BulkID_Invalid |
113 | ContactID_Invalid |
114 | ContactGroupID_Invalid |
115 | CourseID_Invalid |
116 | CourseGroupID_Invalid |
117 | URLAddress_Duplicate |
118 | RelayMessageDeliveryID_Invalid |
119 | RelayRecieveMessageID_Invalid |
120 | Length_Invalid |
121 | Length_Exceeded |
500 | ServerError |
-300 | System_Disabled |
-208 | Token_NotAllowMethod |
-207 | Token_NotAllowIP |
-204 | Token_Expired |
-203 | Token_Disabled |
-202 | Token_Invalid |
-201 | Token_NotExists |
-108 | User_NotAllowMethod |
-107 | User_NotAllowIP |
-106 | User_NotAllowWebService |
-105 | User_WebServiceBanned |
-104 | User_Expired |
-103 | User_Disabled |
-102 | User_MobileNotVerified |
-1 | User_NotExists |