SMSGateway.me Client for API v4
Recently the implementation of the smsgateway.me for sending/receiving SMS's has changed and broke the library that I was using, so I decided to make my own version
Usage
Installation
pip install smsgateway-v4
Token
Get your API Token in the settings page
Client initalization
Before starting is necessary to create the client with the token as parameter
from smsgateway import SMSGateway, Message
client = SMSGateway('your-api-token-here-keep-it-secret')
Device lookup
Sending messages requires the device id, so its necessary to get it
devices = client.search_devices()
if len(devices['results']) == 0:
raise Exception('No device found on your account')
did = devices['results'][0]['id']
Its possible to pass a filter object as parameter as specified on the docs
Sending messages
message1 = Message('12345678', 'Message 1 body', did)
message2 = Message('12345678', 'Message 2 body', did)
status = client.send_message(message1, message2)
print(status)
Support
I decided to implement only the endpoints that I need, but if you need anything else, please make a PR :)
Below what is already implemented and what's not:
Devices
-
✔️ Get devices information -
✔️ Search for devices
Messages
-
✔️ Sending a message -
✔️ Canceling a message -
✔️ Getting a message information -
✔️ Searching for messages
Contacts
-
❌ Creating a contact -
❌ Updating an existing contact -
❌ Adding a phone to an existing contact -
❌ Remove a phone from an existing contact -
❌ Getting a contact information -
❌ Searching for contacts
Callbacks
-
❌ Creating a callback -
❌ Updating an existing callback -
❌ Getting callback information -
❌ Searching for callbacks
Tests
TBD
Contributing
PR's are welcome