Skip to main content

Α python module to use the Termii API

Project description

Pytermii

image

Pytermii provides python bindings for the TERMII API. The pytermii module was created by Aina Adeshina

Requirements

  • requests
  • json

Python version support

  • 2.7
  • 3.4+

Installation

For the stable version

pip install pytermii

Usage

from pytermii.termii import Termii

# Tell pychallonge about your [CHALLONGE! API credentials](http://api.challonge.com/v1).
termii = Termii('your_api_key')

# Retrieve the status of all registered sender ID.
termii.sender_id.fetch()

# Tournaments, matches, and participants are all represented as normal Python dicts.
print(ptermii.sender_id.fetch()['data'][0]['sender_id'])# ACME Key
print(termii.sender_id.fetch()['data'][0]['status']) # unblock

# Request registration of sender ID and print the request code 
termii.sender_id.request_id('Acme', 'Your OTP code is zxsds', 'Acme Corp')

# send text message to a number
# the parameter are to, from_id, sms, type, channel)
# you can see the possible value for the parameter at https://developers.termii.com/messaging
termii.message.send_message('2349133370715', 'ACME', 'A message from pytermii', 'plain', 'generic')

# send bulk message
# the parameter are to (a list of recipient phone number), from_id, sms, type, channel
# you can see the possible value for the parameter at https://developers.termii.com/messaging
termii.message.send_bulk_message(['2349133370715'], 'ACME', 'A message from pytermii', 'plain', 'generic')

# send messages to customers using Termii's auto-generated messaging numbers that adapt to customers location.
# the parameter are to (recipient phone number) and sms
# you can see the possible value for the parameter at https://developers.termii.com/number
termii.number.send_message('2349133370715', "Hi there, testing pytermii")

# set a template for the one-time-passwords (pins) sent to their customers via whatsapp or sms.
# the parameter are phone_number, device_id, template_id, product_name, expiry_time, otp
# otp is automatically generated if none is provided
# you can see the possible value for the parameter at https://developers.termii.com/templates
termii.template.send_template('2349133370715', 'talert', '1493-csdn3-ns34w-sd3434-dfdf', 'Termii', '120435','10 minutes')

# view all phonebooks
termii.phonebook.fetch()

# Create a Phonebook
# you can see the possible value for the parameter at https://developers.termii.com/phonebook
termii.phonebook.create("Phone test", "Phonebook for test")

# Update a Phonebook by name
termii.phonebook.update_by_name('old phonebook name', 'new phonebook name', "Phonebook for test")

# Create a Phonebook
# in case of positional argument,the parameters are phonebook_id, new_phonebook_name new_description
termii.phonebook.update_by_id('phonebook_id', 'new_phonebook_name', 'new_phonebook_description')

# delete a Phonebook
termii.phonebook.delete_by_name('phonebook_id')


# Send a campaign by name
termii.campaign.send_campaign_by_name('phonebook_name', '234', 'sender_id', 'Welcome to Termii.', 'generic', 'Plain', 'personalized', 'scheduled', '30-06-2022 6:00')

# Send a campaign by ID
termii.campaign.send_campaign_by_id('phonebook_id', '234', 'sender_id', 'Welcome to Termii.', 'generic', 'Plain', 'personalized', 'scheduled', '30-06-2022 6:00')

# Fetch campaigns
termii.campaign.fetch_campaigns()

# Fetch campaign history
termii.campaign.fetch_campaign_history('campaign_id')

# Send token
# you can see the possible value for the parameter at https://developers.termii.com/send-token
termii.token.send_token('message_type', '2349133370715', 'Aproved Sender or Device IDs', 'channel', 'pin_attempts', 'pin_time_to_live', 'pin_length', "pin_placeholder", "message_text","pin_type")

# Voice Token
# you can see the possible value for the parameter at https://developers.termii.com/voice-token
termii.token.voice_token('phone_number', 'pin_attempts', 'pin_time_to_live', 'pin_length')

# Voice Call
# you can see the possible value for the parameter at https://developers.termii.com/voice-call
termii.token.voice_call('phone_number', 'code')

# In-App Token
# you can see the possible value for the parameter at https://developers.termii.com/in-app-token
termii.token.in_app_token('pin_type', 'phone_number', 'pin_attempts', 'pin_time_to_live', 'pin_length')

# Verify Token
# you can see the possible value for the parameter at https://developers.termii.com/in-app-token
termii.token.verify_token('pin_id', 'pin')


# Total balance and balance information from your wallet
# you can see the possible value for the parameter at https://developers.termii.com/balance
termii.insight.balance()

# Verify phone numbers and automatically detect their status as well as current network.
# you can see the possible value for the parameter at https://developers.termii.com/search
termii.insight.search('phone_number')

# detect if a number is fake or has ported to a new network.
# you can see the possible value for the parameter at https://developers.termii.com/status
termii.insight.status('phone_number', 'country_code')

#  reports for messages sent across the sms, voice & whatsapp channels.
# you can see the possible value for the parameter at https://developers.termii.com/history
termii.insight.history()

See termii.com for full API documentation.

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

pytermii-0.0.3.tar.gz (8.0 kB view details)

Uploaded Source

File details

Details for the file pytermii-0.0.3.tar.gz.

File metadata

  • Download URL: pytermii-0.0.3.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.25.11 tqdm/4.63.0 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.7.3

File hashes

Hashes for pytermii-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e18d6e791eb406c73362bd932bf5cce95bcab71b1aa33aa7cf11f3089ed6afdf
MD5 9456da423da5ffb4677d22c17c3a3d37
BLAKE2b-256 7664955391b4998016cd0dba3627d3b21ddebb9bffbacef293ae2ace0990a34a

See more details on using hashes here.

Supported by

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