The Elkme Suite

Sending SMS from your Terminal

elkme

elkme is a tool for empowering your UNIX® shell with the ability to send SMS from the command-line using the 46elks API.

You can with minimal effort set up a cronjob to send you a SMS with information about load, the status of the backup-task or the progress of downloading 7½ hours of Norwegian trains (in HD)1.

The idea of elkme is to provide sysadmins, developers and power users with a toolkit to communicate with any phone anywhere at any time from a command-line. SMS is the de facto standard for real-time notifications, and elkme makes using SMS as convenient and accessible as using less.

Installation

Install elkme from the pypi package elkme using pip:

pip install elkme

The source code for elkme is also available on github.com/46elks/elkme and is compatible with Python 2 and 3 (with the sole dependency requests).

You may have to run pip in a virtualenv or as root using sudo if you are trying to install elkme and see something similar to the message below.

OSError: [Errno 13] Permission denied: '/usr/lib/pthon3.5/site-packages/requests-2.9.1.dist-info/DESCRIPTION.rst'

Congratulations, you have now installed elkme!
You can now verify that it works:

elkme --version
elkme 0.4.7 (release date 2016-10-11)
(c) 2015-2016 46elks AB <hello@46elks.com>

Setup

Get started with elkme by registering for a 46elks account and extracting your API keys from the dashboard.

Let elkme generate your configuration file2 for you so you can use elkme whenever you want without having to look for your credentials by using the elkme --saveconf command as seen below.

elkme --saveconf -u (API key) -p (API secret) --to (Your Phonenumber) --from (Your Phonenumber) elkme "Good morning, upper east side"

elkme Python SDK

elkme isn't just your new best friend when it comes to sending SMS from the command-line, it is also the reference implementation for connecting to the 46elks API from Python.

Note:

The elkme Python SDK is in early-beta and is prone to change with every release.

The elkme.elks module contains a very minimal SDK for connecting to 46elks from Python. There is no particular reason to opt for using the SDK over writing your own implementation based on the requests library as the SDK is only a very thin wrapper around the 46elks API.

Connecting 46elks with Python takes less than 100 LoC and you should browse the code to try to understand how it works.

from elkme.elks import Elks

elks_connector = Elks(('API USERNAME', 'API PASSWORD'))

# Allocate a Swedish number
elks_connector.query_api(data={'country':'se'}, endpoint='Numbers')
# Fetch information about the current user
print(elks_connector.query_api(endpoint='Me'))

Help & Support

Is something broken with elkme or you need support with 46elks in general, feel free to contact help@46elks.com
or open a ticket on the GitHub issues page.