Skip to main content

Python package for Ghasedak SMS API

Project description

GhasedakSMS-python

A Python package for interacting with the GhasedakSMS web service API.

Installation

You can simply install this package with pip:

pip install ghasedak_sms

Usage

import ghasedak_sms

# Create an instance:
sms_api = ghasedak_sms.Ghasedak(api_key="Your APIKEY",base="http://your_base_url/api/v1")

# Check SMS status:

response = sms_api.check_sms_status(ghasedak_sms.CheckSmsStatusInput(ids=['messageId1', 'messageId2'], type0='1'))
print(response)

# Get account information:
response = sms_api.get_account_information()
print(response)

# Get received SMSes:
response = sms_api.get_received_smses(ghasedak_sms.GetReceivedSmsInput(line_number='xxxx', is_read=False))
print(response)

# Get received SMSes with pagination:
response = sms_api.get_received_smses_paging(ghasedak_sms.GetReceivedSmsPagingInput(line_number='xxxx', is_read=False, start_date='2023-01-01', end_date='2023-01-31', page_index=0, page_size=10))
print(response)

# Get OTP template parameters:
response = sms_api.get_otp_parameters(ghasedak_sms.GetOtpParametersInput(template_name='YourTemplateName'))
print(response)

# Send a single SMS:
response = sms_api.send_single_sms(ghasedak_sms.SendSingleSmsInput(message='hello, world!', receptor='09xxxxxxxxx', line_number='xxxx', send_date='', client_reference_id=''))
print(response)

# Send a bulk SMS:
response = sms_api.send_bulk_sms(ghasedak_sms.SendBulkInput(message='hello, world!', receptors=['09xxxxxxxxx', '09xxxxxxxxx'], line_number='xxxx', send_date='', client_reference_id=''))
print(response)

# Send pair-to-pair SMS:
response = sms_api.send_pair_to_pair_sms(ghasedak_sms.SendPairToPairInput(items=[
    ghasedak_sms.SendPairToPairInput.SendPairToPairSmsWebServiceDto(
                line_number='123xxxxx',
                receptor='09xxxxxxxxx',
                message='Message 2',
                client_reference_id='client_ref_id',
                send_date='')], udh=False))
print(response)

# Send OTP SMS (New Method):
oldotpcommand = ghasedak_sms.SendOldOtpInput(
        send_date='',
        receptors=[
            ghasedak_sms.SendOtpReceptorDto(
                mobile='09xxxxxxxxx',
                # client_reference_id='client_ref_id'
            )
        ],
        template_name='oldOTP',
        param1='param1_value',
        param2='param2_value',
        param3='param3_value',
        param4='param4_value',
        param5='param5_value',
        param6='param6_value',
        param7='param7_value',
        param8='param8_value',
        param9='param9_value',
        param10='param10_value',
        is_voice=False,
        udh=False
    )
response = sms_api.send_otp_sms_old(oldotpcommand)
print(response)

# Send OTP SMS (New Method):
newotpcommand = ghasedak_sms.SendOtpInput(
        send_date=None,
        receptors=[
            ghasedak_sms.SendOtpReceptorDto(
                mobile='09xxxxxxxxx',
                # client_reference_id='client_ref_id'
            )
        ],
        template_name='newOTP',
        inputs=[
            ghasedak_sms.SendOtpInput.OtpInput(param='Code', value='code'),
            ghasedak_sms.SendOtpInput.OtpInput(param='Name', value='name')
        ],
        udh=False
    )
response = sms_api.send_otp_sms(newotpcommand)
print(response)

License

Released under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ghasedak_sms-1.0.3.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ghasedak_sms-1.0.3-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file ghasedak_sms-1.0.3.tar.gz.

File metadata

  • Download URL: ghasedak_sms-1.0.3.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for ghasedak_sms-1.0.3.tar.gz
Algorithm Hash digest
SHA256 e7ef3f9e2f79a989347b9a6524559533d48ecb71cdd173936b3236fc5bd15c8e
MD5 fbd7b54e4473b954f6fb3dc58be879b2
BLAKE2b-256 a53f9111faf6deec178370a931f823730ea6089fcf8f3d451ca9340e91b62b90

See more details on using hashes here.

File details

Details for the file ghasedak_sms-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: ghasedak_sms-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for ghasedak_sms-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6b2fd5e78b84e9ad6784667603c5a21b75c3cce299c8f3baca2e9a2d0f312e59
MD5 b3e493fc90f79aafad108d5bb3d78156
BLAKE2b-256 16e264e496465ca4550fea96cee7b23b77c8374b277fe2efa879e18f34659525

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page