ارسال پیامک (SendSimple)

برای خرید سامانه پیامک همین الان در پیامک آموت ثبت نام کنید

متد وب سرویس ارسال پیامک (SendSimple)

آخرین بروزرسانی یکشنبه 1 مرداد 1402 16:26
Loading

آدرس وب سرویس

Rest Url

متد SendSimple

از طریق این متد می توانید با وارد کردن متن و شماره ، پیامک های خود را به شماره یا شماره های انتخابی ارسال نمایید.

پارامترهای ورودی

Loading
نام نوع توضیحات
TokenString الزامیتوکن ثبت شده در سامانه پیامک آموت
SendDateTimeObject الزامیزمان ارسال پیامک
SMSMessageTextString الزامیمتن پیامک
LineNumberString الزامیشماره خط
MobilesObject الزامیلیست موبایل های دریافت کنندگان پیامک

مقدار خروجی

Loading
نام نوع توضیحات
ReturnValueObjectresult.Data شامل آرایه ای از یک کلاس با مقادیر
{
Status = وضعیت ,
MessageID = کد پیامک (کد شماره کمپین) ,
Mobile = شماره موبایل
}

نمونه کد

Loading
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: '/webservice2.asmx/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();

وضعیت

Loading
Status Title
0Failed
1Success
2AccountIsDemo
4CreditNotEnough
5LineNumber_NotExist
6BackupLineNumber_NotExist
7Avanak_NotAvailable
10UserName_Empty
11Password_Empty
12LineNumber_Empty
13BackupLineNumber_Empty
14SMSMessageText_Empty
15AvanakMessageText_Empty
16Mobile_Empty
17Mobiles_Empty
18Title_Empty
19FirstNameOrLastName_Empty
20URLAddress_Empty
100UserNameOrPassword_Invalid
101Mobile_Invalid
102Mobiles_Invalid
103Count_Invalid
104FromRow_Invalid
105FromDate_Invalid
106FromDateTime_Invalid
107ToDate_Invalid
108ToDateTime_Invalid
109FromDateIsAfterThanToDate
110FromDateTimeIsAfterThanToDateTime
111MessageID_Invalid
112BulkID_Invalid
113ContactID_Invalid
114ContactGroupID_Invalid
115CourseID_Invalid
116CourseGroupID_Invalid
117URLAddress_Duplicate
118RelayMessageDeliveryID_Invalid
119RelayRecieveMessageID_Invalid
120Length_Invalid
121Length_Exceeded
500ServerError
-300System_Disabled
-208Token_NotAllowMethod
-207Token_NotAllowIP
-204Token_Expired
-203Token_Disabled
-202Token_Invalid
-201Token_NotExists
-108User_NotAllowMethod
-107User_NotAllowIP
-106User_NotAllowWebService
-105User_WebServiceBanned
-104User_Expired
-103User_Disabled
-102User_MobileNotVerified
-1User_NotExists