This tutorial explains how to send an SMS from your Raspberry Pi without using a GSM modem. In this tutorial, we'll be sending the SMS through the internet using the ClickSend SMS API.
Create an account at ClickSend.com
Create a Python script and add your ClickSend credentials
csharp
# - * -coding: utf - 8 - * -username = 'User'
# Your ClickSend username api_key = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
# Your Secure Unique API key msg_to = '+61411111111'
# Recipient Mobile Number in international format(+61411111111 test number).msg_from = ''
# Custom sender ID(leave blank to accept replies).msg_body = 'This is a test message'
# The message to be sent.import json, subprocess request = {
"messages": [{
"source": "rpi",
"from": msg_from,
"to": msg_to,
"body": msg_body
}]
}
request = json.dumps(request) cmd = "curl https://rest.clicksend.com/v3/sms/send -u " + username + ":" + api_key + " -H \"Content-Type: application/json\" -X POST --data-raw '" + request + "'"
p = subprocess.Popen(cmd, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)(output, err) = p.communicate() print outputConnect to the Raspberry Pi via SSH/PuTTY (Raspberry pi must be connected to the Internet) https://raspberrypi4dummies.wordpress.com/2013/03/17/connect-to-the-raspberry-pi-via-ssh-putty/
Copy script clicksend.py from your windows PC to your Raspberry Pi. (../home/pi)
Start script clicksend.py with your parameters: python clicksend.py
Done! Your SMS should've been sent by now.
We'd love to hear what you've created. Please get in touch with us for some free SMS credits
:format(webp))