Package: pingsms-api
Python Pingsms API PackageThis is a python package forhttps://pingsms.inAPI. If you are looking for API usage in PHPclick here!ContentsInstallationUsageImporting the packageInputMethodsExamplesOutputError CodesGet Api KeyInstallationThe package is located atPyPIand can be installed with apipcommand. To install the package simply run:-pip install pingsms-apiUsageImporting the packageTo start using the package first we need to import the package.Note: Our package name ispingsms-apibut from now on we will be usingpingsmsonly for all our tasks.To import the package run the following command:-import pingsmsInputOnly one variable of dictionary data type is sent to the methods. A sample dictionary variable is provided for reference:"""Sample Variable"""custom_data={"key":"AMjdkshmsaZdoV6PGWoSbejmEgFZ905EdmaanahwqkwNVc ","job_id":"021839426237963","report_date":"2021-06-12","product":"1","language":"1","sender":"PNGSMS","mobile":"1232123451","template":"282222382902","message":"Hello World!"}There is a total of 9 elements (known as key:value pairs) allowed in the dictionary. Any additional parameters are ignored.key :A user is identified by a unique hashed key. This key can be generated from thehttps://pingsms.inuser panel. All pingsms customers have free access to API keys. This is an mandatory field required by all the methods.job_id :The Job Id number. This parameter is only used in the methodget_job_report()report_date :Date Of Report in YYYY-MM-DD Format.This parameter is used in the methodget_job_report()andget_sent_sms_reports()product :Choose between two product types1 - Transactional2 - PromotionalThis parameter is only used in the methodsend_single_sms()andsend_multiple_sms(custom_data)language :Choose between two language formats1 - English2 - Unicode (Regional Language)This parameter is only used in the methodsend_single_sms()andsend_multiple_sms(custom_data)sender :User's approved 6 characters Sender Id.This parameter is only used in the methodsend_single_sms()andsend_multiple_sms(custom_data)mobile :10 digit recipient mobile number. (In case of multiple sms mobile numbers should be provide in comma(,) separated form).This parameter is only used in the methodsend_single_sms()andsend_multiple_sms(custom_data)template :Authorised Template number of the user.This parameter is only used in the methodsend_single_sms()andsend_multiple_sms(custom_data)message :Authorised message format against the Template number.This parameter is only used in the methodsend_single_sms()andsend_multiple_sms(custom_data)MethodsThere are total of 5 available methods:get_sms_balance(custom_data) :Get Transactional and Promotional Balance of The User.Input Parameter's Required:keyOutput: JSONget_sender_id(custom_data) :Get List of Sender Ids of The User.Input Parameter's Required:keyOutput: JSONget_job_report(custom_data) :Get Job Report of the User.Input Parameter's Required:key,job_id,report_dateOutput: JSONget_sent_sms_reports(custom_data) :Get SMS sent reports of the User.Input Parameter's Required:key,report_date,productOutput: JSONsend_single_sms(custom_data) :Send Single SMS.Input Parameter's Required:key,sender,mobile,language,product,message, templateOutput: JSONsend_multiple_sms(custom_data) :Send Multiple SMS.Input Parameter's Required:key,sender,mobile(multiple and comma separated),language,product,message,templateOutput: JSONExamples"""Example 1"""importpingsmscustom_data={"key":"AMjdkshmsaZdoV6PGWoSbejmEgFZ905EdmaanahwqkwNVc ",}pingsms.get_sms_balance(custom_data)"""Example 2"""importpingsmscustom_data={"key":"AMjdkshmsaZdoV6PGWoSbejmEgFZ905EdmaanahwqkwNVc ","product":"1","language":"1","sender":"PNGSMS","mobile":"1232123451","template":"282222382902","message":"Hello World!"}pingsms.send_multiple_sms(custom_data)OutputAll outputs are returned in the form of JSON."""Example 1 Output"""{"code":201,"status":"Success","message":"User balance details found","available_balance":{"transactional_balance":9248,"promotional_balance":1029}}"""Example 2 Output"""{"code":201,"status":"Success","message":"Message Sent","job_id":"11312351841231313"}Error CodesError CodeMeaningUnauthorizedIncorrect API key or the account is blocked.1This error occurs when no recipients is found.2This error occurs when no sender name is specified.3Invalid Sender Id for this domain. This error appears if you use a Sender Id which is not specified for your account.4This error occurs when the Language id is missing or not specified. Choose between two language formats                                      1 - English                                      2 - Unicode (Regional Language)5This error occurs when the Product id is missing or not specified. Choose between two Product types                                      1 - Transactional                                      2 - Promotional6This error occurs when no Message  Content is found. This error occurs when message content is missing.11This error occurs when the Message size exceeds the given limit. Please check your account balance and message size.12Mobile numbers should not be more than 500. This error occurs when the number of mobile number in multiple SMS  exceeds 500.15This error occurs when Job Id is missing.17This error occurs when the Date is missing.18This error occurs when the Date format is invalid. The date should be inYYYY-MM-DDformat.101This error occurs when the account has Insufficient Balance. Recharge your account to fix this issue.102This error occurs when API Key is not specified.143This error occurs when the User not found or Inactive.151This error occurs when Job Id and date doesn't match or the Job Id is incorrect.142Unauthorized IP Address. This error appears when the IP of the server which sent the GET request didn't match the whitelisted IP list.500This error occurs usually when the problem is on our end. Kindly, notify us immediately when you face this issue.Get API Key-Sign Up at https://pingsms.in
     -Get API Key from Developer API Tab