Skip to main content

Python Pingsms API Package

This is a python package for https://pingsms.in API. If you are looking for API usage in PHP click here!

Contents

  1. Installation
  2. Usage
    1. Importing the package
    2. Input
    3. Methods
    4. Examples
    5. Output
  3. Error Codes
  4. Get Api Key

Installation

The package is located at PyPI and can be installed with a pip command. To install the package simply run:-

pip install pingsms-api 

Usage

Importing the package

To start using the package first we need to import the package.
Note: Our package name is pingsms-api but from now on we will be using pingsms only for all our tasks.
To import the package run the following command:-

import pingsms

Input

Only 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.

  1. key : A user is identified by a unique hashed key. This key can be generated from the https://pingsms.in user panel. All pingsms customers have free access to API keys. This is an mandatory field required by all the methods.
  2. job_id : The Job Id number. This parameter is only used in the method get_job_report()
  3. report_date : Date Of Report in YYYY-MM-DD Format.This parameter is used in the method get_job_report() and get_sent_sms_reports()
  4. product : Choose between two product types
    1 - Transactional
    2 - Promotional
    This parameter is only used in the method send_single_sms() and send_multiple_sms(custom_data)
  5. language : Choose between two language formats
    1 - English
    2 - Unicode (Regional Language)
    This parameter is only used in the method send_single_sms() and send_multiple_sms(custom_data)
  6. sender : User's approved 6 characters Sender Id.
    This parameter is only used in the method send_single_sms() and send_multiple_sms(custom_data)
  7. 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 method send_single_sms() and send_multiple_sms(custom_data)
  8. template : Authorised Template number of the user.
    This parameter is only used in the method send_single_sms() and send_multiple_sms(custom_data)
  9. message : Authorised message format against the Template number.
    This parameter is only used in the method send_single_sms() and send_multiple_sms(custom_data)

Methods

There are total of 5 available methods:

  1. get_sms_balance(custom_data) :
    Get Transactional and Promotional Balance of The User.
    Input Parameter's Required:key
    Output: JSON
  2. get_sender_id(custom_data) :
    Get List of Sender Ids of The User.
    Input Parameter's Required:key
    Output: JSON
  3. get_job_report(custom_data) :
    Get Job Report of the User.
    Input Parameter's Required:key,job_id,report_date
    Output: JSON
  4. get_sent_sms_reports(custom_data) :
    Get SMS sent reports of the User.
    Input Parameter's Required:key,report_date,product
    Output: JSON
  5. send_single_sms(custom_data) :
    Send Single SMS.
    Input Parameter's Required:key,sender,mobile,language,product,message, template
    Output: JSON
  6. send_multiple_sms(custom_data) :
    Send Multiple SMS.
    Input Parameter's Required:key,sender,mobile(multiple and comma separated),language,product,message,template
    Output: JSON

Examples

"""
Example 1
"""
import pingsms
custom_data = {
"key": "AMjdkshmsaZdoV6PGWoSbejmEgFZ905EdmaanahwqkwNVc ",
}
pingsms.get_sms_balance(custom_data)
"""
Example 2
"""
import pingsms
custom_data = {
"key": "AMjdkshmsaZdoV6PGWoSbejmEgFZ905EdmaanahwqkwNVc ",
"product":"1",
"language":"1",
"sender":"PNGSMS",
"mobile":"1232123451",
"template":"282222382902",
"message":"Hello World!"
}
pingsms.send_multiple_sms(custom_data)

Output

All 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 Codes

Error Code Meaning
Unauthorized Incorrect API key or the account is blocked.
1 This error occurs when no recipients is found.
2 This error occurs when no sender name is specified.
3 Invalid Sender Id for this domain. This error appears if you use a Sender Id which is not specified for your account.
4 This error occurs when the Language id is missing or not specified. Choose between two language formats 1 - English 2 - Unicode (Regional Language)
5 This error occurs when the Product id is missing or not specified. Choose between two Product types 1 - Transactional 2 - Promotional
6 This error occurs when no Message Content is found. This error occurs when message content is missing.
11 This error occurs when the Message size exceeds the given limit. Please check your account balance and message size.
12 Mobile numbers should not be more than 500. This error occurs when the number of mobile number in multiple SMS exceeds 500.
15 This error occurs when Job Id is missing.
17 This error occurs when the Date is missing.
18 This error occurs when the Date format is invalid. The date should be in YYYY-MM-DD format.
101 This error occurs when the account has Insufficient Balance. Recharge your account to fix this issue.
102 This error occurs when API Key is not specified.
143 This error occurs when the User not found or Inactive.
151 This error occurs when Job Id and date doesn't match or the Job Id is incorrect.
142 Unauthorized IP Address. This error appears when the IP of the server which sent the GET request didn't match the whitelisted IP list.
500 This 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

API_KEY

Release files for pingsms-api 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pingsms-api 1.0.3
File Size Uploaded
pingsms-api-1.0.3.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pingsms-api 1.0.3
File Interpreter ABI Platform
pingsms_api-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 11.2 kB

Release files / pingsms-api-1.0.3.tar.gz

Download URL pingsms-api-1.0.3.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
59609020248304a89195487bca426138ea382f84c0a640800e4839de373a73c2
BLAKE2b-256 checksum
How to use checksums
d13cbbc1e4610e4c3426a08ad00bfcc22794173db57bde43330419434b6da5b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

Release files / pingsms_api-1.0.3-py3-none-any.whl

Download URL pingsms_api-1.0.3-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8696e2994e904f72a2c58d5a1078489d06ad0e863ed0b207b8054a992b7e199b
BLAKE2b-256 checksum
How to use checksums
812ba4fdc363415e435ec1525e0c0c6c54565fa8824d8a8bd1aef80bb43752b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page