The python library provides easy access to Termii API for Python users. Accelerate development with our Python library by abstracting Termii API complexities and providing easy-to-use functions.
Please see the docs for the most up-to-date documentation of Termii API.
Available features include:
- Campaigns: send, list and history
- Contacts: list, create(single/bulk) and delete
- Insights: balance, history, search and status
- Messaging: sms(single/bulk), template api, number api
- Phonebooks: list, create, update and delete
- SenderID: list, request
- Token: voice_call, voice_token, email_token, send, in_app, verify
- Termii API Keys
- Supported Python versions: >3.8
To install this library (preferably in an active virtual environment) simply run
pip install termii-clientImport entry class for this package from termii_client.
from termii_client import TermiiWith this you have access to all the features this library has to offer.
To initialize the library simply create a Termii object, while supplying the api key, you can find one in your Termii dashboard.
termii = Termii("Your API Key")
This is a documentation for all components on termii_client
Note: For convenience, this library will automatically populate the field
api_keyusing the value specified during initialization. for every payload where it is required, but not provided.
This is used for handling all campaign related resources on termii.
Functions included are:
.send.list.history
Send a campaign. The payload is a dictionary containing campaign information, optionally excluding api_key.
payloadapi_key (optional)country_codesender_idmessagechannelmessage_typephonebook_idcampaign_typeschedule_sms_statusschedule_time
Retrieve list of all campaigns.
pagination_url (optional): In order to transverse through pages (if any), simply pass the next or previous page url as the keyword argument pagination_url.
Retrieve history for specified campaign.
campaign_id: campaign id to retrieve it's historypagination_url (optional): In order to transverse through pages (if any), simply pass the next or previous page url as the keyword argument pagination_url.
This is used for handling contacts in termii phonebooks.
Functions included are:
.list.create.create_bulk.delete
Retrieve list of all contacts in the specified phonebook.
phonebook_id: phone book id to retrieve it's contactspagination_url (optional): In order to transverse through pages (if any), simply pass the next or previous page url as the keyword argument pagination_url.
Create new contact in the specified phonebook
phonebook_id: phone book id to create contact on.payloadapi_key (optional)phone_numbercountry_codeemail_addressfirst_namelast_namecompany
Create bulk of new contacts in the specified phonebook
phonebook_id: phone book id to create contact on.payloadapi_key (optional)contact_filecountry_code
Delete a specified contact
contact_id: id of contact to delete
This is used for handling resources related to insights
Functions included are:
.balance.history.search.status
Retrieve termii account balance
Retrieve reports for messages sent across the sms, voice & whatsapp channels.
pagination_url (optional): In order to transverse through pages (if any), simply pass the next or previous page url as the keyword argument pagination_url.
Verify phone numbers and automatically detect their status as well as current network.
phone_number: phone number to detect status and current network
Verify if a number is fake or has ported to a new network.
phone_number: phone number to fake and ported statuscountry_code: phone number country code
This is used for handling resources related to Messaging/SMS
Functions included are:
.send.send_bulk.send_auto_message.send_template_message
Send single sms on termii api
payloadapi_key (0ptional)tofromsmstypechannelmedia (Optional Dict)urlcaption
Send bulk sms on termii api
payloadapi_key (0ptional)tofromsmstypechannel
Send single sms on termii api with auto generated numbers
payloadapi_key (0ptional)tofrom
Set a template for the one-time-passwords (pins) sent to their customers via whatsapp or sms.
payloadapi_key (0ptional)phone_numberdevice_idtemplate_iddata
This is used for handling all phonebook related resources on termii.
Functions included are:
.list.create.update.delete
Retrieve list of all phonebooks
pagination_url (optional): In order to transverse through pages (if any), simply pass the next or previous page url as the keyword argument pagination_url.
Retrieve list of all phonebooks
phonebook_namedescription (optional)
Update existing phonebook
phonebook_id: Phonebook ID to updatephonebook_name: New phonebook name
Delete existing phonebook
phonebook_id: Phonebook ID to delete
This is used for handling all phonebook related resources on termii.
Functions included are:
.list.request
Retrieve list of all sender ID's
pagination_url (optional): In order to transverse through pages (if any), simply pass the next or previous page url as the keyword argument pagination_url.
Request for a sender id
sender_id: sender id being requested eg: CompanyNameusecase: a sample of the type of message to be sent.company: name of the company with the sender ID
This is used for handling all phonebook related resources on termii.
Functions included are:
.voice_call.email_token.in_app.send.verify.voice_token
Send messages from your application through our voice channel to a phone number.
payloadapi_key (Optional)phone_numbercode
Send one-time-passwords from your application through our email channel to an email address.
payloadapi_key (Optional)email_addresscodeemail_configuration_id
Returns OTP codes in JSON format which can be used within any web or mobile app.
payloadapi_key (Optional)phone_numberpin_attemptspin_time_to_livepin_length
Send one-time-passwords (OTP) across any available messaging channel on Termii
payloadapi_key (Optional)message_typetofromchannelpin_attemptspin_time_to_livepin_lengthpin_placeholdermessage_text
Check status of tokens sent to customers.
payloadapi_key (Optional)pin_idpin
Generate and trigger one-time passwords (OTP) through the voice channel to a phone number.
payloadapi_key (Optional)phone_numberpin_attemptspin_time_to_livepin_length
I understand that you may run into some errors while integrating this library. Please open discussion on any problems you may have about this library
For authorization and validation error responses, double-check your API keys and request. If you get a server error, kindly engage the Termii for support @+234-8137751523.
For additional assistance using this library, feel free to reach out, i'll be looking forward to it.
You can also follow me on twitter and github and linkedin. 😊.
By contributing to this library, you agree that your contributions will be licensed under its MIT license.
Read more about our community contribution guidelines here