ملی پیامک یک وب سرویس کامل برای ارسال و دریافت پیامک و پیامک صوتی و مدیریت کامل خدمات دیگر است که براحتی میتوانید از آن استفاده کنید.
قبل از نصب نیاز به ثبت نام در سایت ملی پیامک دارید.
ثبت نام به همراه دریافت 200 پیامک هدیه جهت تست وبسرویس
پس ازثبت نام برای نصب از راههای زیر میتوانید اقدام کنید.
برای استفاده از نمونه کدهای پایتون نیاز به نصب پکیج های زیر است:
pip install zeep
pip install requests
from melipayamak import Api
username = 'username'
password = 'password'
api = Api(username,password)
sms = api.sms()
to = '09123456789'
_from = '5000...'
text = 'تست وب سرویس ملی پیامک'
response = sms.send(to,_from,text)
print(response)
از آنجا که وب سرویس ملی پیامک تنها محدود به ارسال پیامک نیست شما از طریق زیر میتوانید به وب سرویس ها دسترسی کامل داشته باشید:
// وب سرویس پیامک
sms_rest = api.sms()
sms_soap = api.sms('soap')
// وب سرویس تیکت پشتیبانی
ticket = api.ticket()
// وب سرویس برای مدیریت کامل ارسال انبوه پیامک
branch = api.branch()
//وب سرویس کاربران
users = api.users()
//وب سرویس دفترچه تلفن
contacts = api.contacts()
از آنجا که ملی پیامک وب سرویس کاملی رو در اختیار توسعه دهندگان میگزارد برای راحتی کار با وب سرویس پیامک علاوه بر وب سرویس اصلی soap وب سرویس rest رو هم در اختیار توسعه دهندگان گزاشته شده تا راحتتر بتوانند با وب سرویس کار کنند. تفاوت اصلی این دو در تعداد متد هاییست که میتوانید با آن کار کنید. برای کار های پایه میتوان از وب سرویس rest استفاده کرد برای دسترسی بیشتر و استفاده پیشرفته تر نیز باید از وب سرویس باید از وب سرویس soap استفاده کرد. جهت مطالعه بیشتر وب سرویس ها به قسمت وب سرویس پنل خود مراجعه کنید.
برای مطالعه بیشتر و دریافت راهنمای وب سرویس ها و آشنایی با پارامتر های ورودی و خروجی وب سرویس به صفحه معرفی وب سرویس ملی پیامک مراجعه نمایید .
متد های وب سرویس:
sms_rest.send(to,from,text,is_flash)
sms_soap.send(to,from,text,is_flash)
- در وب سرویس soap به جای ارسال یک شماره آرایه ای از شماره ها نیز قابل قبول است
sms_rest.send_by_base_number(text, to, bodyId)
sms_soap.send_by_base_number(text, to, bodyId)
sms_rest.is_delivered(recId)
sms_soap.is_delivered(recId)
- به در وب سرویس soap به جای تک آیدی میتوان آرایه نیز ارسال کرد.
sms_rest.get_messages(location,index,count,from)
sms_soap.get_messages(location,index,count,from)
sms_soap.get_messages_str(location,index,count,from)
// جهت دریافت به صورت رشته ای
sms_soap.get_messages_by_date(location,index,count,from,date_from,date_to)
//جهت دریافت بر اساس تاریخ
sms_soap.get_users_messages_by_date(location,index,count,from,date_from,date_to)
// جهت دریافت پیام های کاربران بر اساس تاریخ
sms_rest.get_credit()
sms_soap.get_credit()
sms_rest.get_base_price
sms_soap.get_price(irancell_count,mtn_count,from,text)
sms_rest.get_numbers()
sms_soap.get_inbox_count(is_read)
//پیش فرض خوانده نشده
sms_soap.send2(to,from,text,is_flash,udh)
sms_soap.get_messages_receptions(msgId,from_rows)
sms_soap.remove(msgIds)
sms_soap.send_schedule(to,from,text,is_flash,schedule_dateTime,period)
sms_soap.send_multiple_schedule(to,from,text,is_flash,schedule_dateTime,period)
sms_soap.add_usance(to,from,text,isflash,schedule_start_date_time,repeat_after_days,schedule_end_dateTime)
sms_soap.get_schedule_status(schId)
sms_soap.remove_schedule(schId)
sms_soap.send_with_speech(to,from,text,speech)
sms_soap.send_with_speech_schdule_date(to,from,text,speech,schedule_date)
sms_soap.get_send_with_speech(rec_id)
sms_soap.send_bulk_speech_text(self, title, body, receivers, DateToSend, repeatCount)
sms_soap.send_bulk_voice_sms(self, title, voiceFileId, receivers, DateToSend, repeatCount)
sms_soap.upload_voice_file(self, title, base64StringFile)
branch.get(owner)
branch.add(branch_name,owner)
branch.add_number(mobile_numbers,branch_id)
branch.remove(branch_id)
branch.send_bulk(from,title,message,branch,Date_to_send,request_count,bulk_type,row_from,range_from,range_to)
branch.send_bulk2(from,title,message,branch,Date_to_send,request_count,bulk_type,row_from,range_from,range_to)
branch.get_bulk_count(branch,range_from,range_to)
branch.get_bulk_receptions(bulk_id,from_rows)
branch.get_bulk_status(bulk_id)
branch.get_today_sent()
branch.get_total_sent()
branch.remove_bulk(id)
branch.send_multiple_sms(to,from,text,is_flash,udh)
branch.update_bulk_delivery(bulk_id)
ticket.add(title,content,alert_with_sms)
ticket.get_received(ticket_owner,ticket_type,keyword)
ticket.get_received_count(ticket_type)
ticket.get_sent(ticket_owner,ticket_type,keyword)
ticket.get_sent_count(ticket_type)
ticket.response(ticket_id,type,content,alert_with_sms)
contacts.add_group(group_name,Descriptions,show_to_childs)
contacts.add(options)
contacts.check_mobile_exist(mobile_number)
contacts.get(group_id,keyword,from,count)
contacts.get_groups()
contacts.change(options)
contacts.remove(mobile_number)
contacts.get_events(contact_id)
users.add_payment(options)
users.add(options)
users.add_complete(options)
users.add_with_location(options)
users.authenticate()
users.change_credit(amount,description,target_username,Get_tax)
users.forgot_password(mobile_number,email_address,target_username)
users.get_base_price(target_username)
users.get_credit(target_username)
users.get_details(target_username)
users.get_numbers()
users.get_transactions(target_username,credit_type,date_from,date_to,keyword)
users.get()
users.has_filter(text)
users.remove(target_username)
users.get_provinces()
users.get_cities(province_id)
users.get_expire_date()