Skip to content

eefret/clickatell-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clickatell Python Library

Master: Build Status

This library allows easy access to connecting the Clickatell's different messenging API's.

The library supports both version 2 and 3 of Python.

  1. Installation

You can install this library via PIP as part of you requirements file.

pip install clickatell

Clickatell Python PyPI

  1. Usage

The library currently supports the Http and Rest protocols.

HTTP API

from clickatell.http import Http

clickatell = Http(username, password, apiID)
response = clickatell.sendMessage(['1111111111'], "My Message")

for entry in response:
    print(entry['id'])
    # entry['id']
    # entry['destination']
    # entry['error']
    # entry['errorCode']

REST API

from clickatell.rest import Rest

clickatell = Rest(token);
response = clickatell.sendMessage(['1111111111'], "My Message")

for entry in response:
    print(entry['id'])
    # entry['id']
    # entry['destination']
    # entry['error']
    # entry['errorCode']

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.

  1. Supported API calls

The available calls are defined in the clickatell.Transport interface.

def sendMessage(self, to, message, extra={})

def getBalance(self)

def stopMessage(self, apiMsgId)

def queryMessage(self, apiMsgId)

def routeCoverage(self, msisdn)

def getMessageCharge(self, apiMsgId)
  1. 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.

About

Python library to interact with the Clickatell SMS gateway.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%