Library for interacting with the Clickatell Platform SMS Gateway
Project description
Clickatell Python Library
This library supports version 2.7 & 3.6 of Python.
This library allows easy access to connecting the Clickatell's different messenging API's.
Installation
You can install this library via PIP as part of your requirements file.
pip install clickatell-platform
Usage
The library currently supports the Http and Rest protocols.
HTTP API
from clickatell.http import Http
clickatell = Http(apiKey)
response = clickatell.sendMessage(['1111111111'], "My Message rest")
print(response) #Returns the headers with all the messages
for entry in response['messages']:
print(entry) #Returns all the message details per message
#print(entry['apiMessageId'])
#print(entry['to'])
#print(entry['accepted'])
#print(entry['error'])
REST API
from clickatell.rest import Rest
clickatell = Rest(apiKey)
response = clickatell.sendMessage(['1111111111'], "My Message rest")
print response #Returns the headers with all the messages
for entry in response['messages']:
print(entry) #Returns all the message details per message
#print(entry['apiMessageId'])
#print(entry['to'])
#print(entry['accepted'])
#print(entry['error'])
Sending to multiple numbers
The sendMessage call to parameter can take an array of numbers. If you specify only a single number like clickatell.sendMessage(1111111111, "Message") the library will automatically convert it to an array for your convenience.
To send to multiple numbers, just pass a list of numbers like clickatell.sendMessage([1111111111,2222222222], "Message")
Supported API calls
The available calls are defined in the clickatell.Transport interface.
def sendMessage(self, to, message, extra={})
Dealing with extra parameters in sendMessage
For usability purposes the sendMessage call focuses on the recipients and the content. In order to specify and of the additional parameters defined
in the Clickatell document, you can use the extra parameter and pass them as a dictionary.
Receiving and consuming the status callback
The following will be returned from the callback in two different sets:
DELIVERED_TO_GATEWAY :
- integrationName
- messageId
- requestId
- clientMessageId
- to
- from
- statusCode
- status
- statusDescription
- timestamp
RECEIVED_BY_RECIPIENT :
- integrationName
- messageId
- requestId
- clientMessageId
- to
- from
- statusCode
- status
- statusDescription
- timestamp
There is a python test server included in the clickatell folder. To run this server, you require the endpoints pip package:
pip install endpoints
You can run the server using the following command:
endpoints --dir=clickatell/ --prefix=controller --host=<hostname>:<port>
This server currently prints out to the server console. Replace the print function with your function name to consume the data. All data is returned in JSON.
Reference Links and More Info:
Found a bug or missing a feature? Log it here and we will take a look. https://github.com/clickatell/clickatell-python/issues
Register a new account to send sms's: https://www.clickatell.com/sign-up/
Login to platform for API id, etc: https://portal.clickatell.com/#/login
Request Parameters: https://www.clickatell.com/developers/api-documentation/rest-api-request-parameters/
Send Message Info: https://www.clickatell.com/developers/api-documentation/rest-api-send-message/
Error Messages: https://www.clickatell.com/developers/api-documentation/rest-api-error-message-descriptions/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clickatell-platform-2.0.1.tar.gz.
File metadata
- Download URL: clickatell-platform-2.0.1.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e45b7b47bbf359689bcb3311f92e3d1cd6ce6cb8961dfd5478ccbc271406171c
|
|
| MD5 |
440a91a222b4e7816a4e02c87b137ad8
|
|
| BLAKE2b-256 |
c67e39a79ba5bf512c8be185182913f845e57163a57c569b16a82bb29c10ce97
|
File details
Details for the file clickatell_platform-2.0.1-py3-none-any.whl.
File metadata
- Download URL: clickatell_platform-2.0.1-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
015609e7165912257624a9303b23f52dfc958a53559637aeaad28a8fd16444dd
|
|
| MD5 |
624c5a397ac41dd33ebd916d356d8cbc
|
|
| BLAKE2b-256 |
b79c0e9fa5f2ab20a9dfe14099ac9335a278457156b7c02456b071c0bbfb0b10
|
File details
Details for the file clickatell_platform-2.0.1-py2-none-any.whl.
File metadata
- Download URL: clickatell_platform-2.0.1-py2-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ef0712794dc39ccfd4b32f22c6bbbcf8fa48dab5a11375e829aa800b3601a0f
|
|
| MD5 |
22883282b6ed3f0a75bf3035469bde23
|
|
| BLAKE2b-256 |
a66a9ebe234da1e7cd3f7616f67f191bf15e05eefb9f349fc2ab2476c4e79381
|