Open in app
Search
DIY SMS Gateway: Send Messages Anytime,
Anywhere
Tomer Klein · Follow
5 min read · Oct 22, 2023
Listen Share More
DIY SMS Gateway
Introduction
In this step-by-step guide, we will walk you through the process of building your
very own SMS gateway. This DIY solution will enable you to send SMS messages
efficiently and cost-effectively. Whether you want to receive notifications from
monitoring systems or control your smart home, this SMS gateway can be tailored to
your needs. We will break down the process into easy-to-follow stages, so you can
have your SMS gateway up and running with minimal monthly costs.
Why Build Your Own SMS Gateway? Before we dive into the setup, let’s explore why
you might need to create your own SMS gateway. Whether you want to receive
alerts, notifications, or messages from various systems, this DIY solution provides a
flexible and affordable option. It’s designed for smaller-scale use, making it perfect
for home automation, security systems, and more.
Let’s get started.
Table of Contents:
1. Setting Up an MQTT Server
2. Installing and Configuring the Zanzito Application
3. Checking the System and Sending Test SMS
4. Sending SMS Using a Micro Service
Step 1 — Setting Up an MQTT Server
In this section, we will guide you through the installation of an MQTT server, which
is essential for our SMS gateway.
MQTT, or Message Queuing Telemetry Transport, is a lightweight messaging
protocol commonly used in IoT devices, such as ESP8266 and Raspberry Pi. It is
ideal for systems with low resources and battery-powered applications like home
automation, alarm systems, and sensor networks.
To set up your MQTT server, you have two options:
a. Installing MQTT on Linux (Ubuntu/Raspberry Pi) — Follow the instructions in this
guide.
b. Using Docker Containers — Refer to this guide for installation steps.
Step 2 — Installing and Configuring the Zanzito Application
Now that you have your MQTT server up and running, it’s time to install and
configure the Zanzito application. This application will serve as the bridge between
your devices and the MQTT server.
Here’s how to do it:
Download the Zanzito application.
Set up preferences for the MQTT connection.
Click one the menu to open
Go to Preferences
Configure Home Host settings for wireless network use.
Click on “MQTT Connection”
Configure MQTT
Set MQTT Home host (In your LAN)
Define your device name, which will be used to identify your device during
message sending.
Set Device Name (Will be used for MQTT Topic)
Also make sure to enable Automatic Connection and AutoRestart
On the main preferences screen, click on “Send SMS” and check the “Send SMS”
and “Android notifications”
Step 3 — Checking the System and Sending Test SMS
In this section, we’ll check if the system is functioning correctly and send a test SMS
to verify its operation. We’ll use the MQTT Explorer tool for this purpose.
Follow these steps:
Connect to your MQTT server using MQTT Explorer.
Locate your Zanzito device in the list.
Observe various information, such as battery percentage and charging status.
Ensure that the SMS sending option is active.
To send a test SMS, use the following MQTT topic format:
zanzito/[devicename]/sendsms/[target_phone_number]
Click the “PUBLISH” button to send the SMS:
Step 4 — Sending SMS using a Microservice
In this final section, we’ll demonstrate how to create a microservice that allows you
to send SMS messages. You’ll need to install the required dependencies and
configure the service according to your MQTT server’s details, including the server
address, port, username, password, and your Zanzito device’s name.
First, we need to install the necessary dependencies for the proper functioning of
the interface. To do this, enter the following command:
sudo pip3 install flask flask_restful paho-mqtt --yes
Now, download the code from my GitHub repository using the following command:
git clone https://github.com/t0mer/sms-gateway
Next, navigate to the directory that was created
cd sms-gateway
Open and edit the “smssender.py” file, and update the values in the following lines
to match your specific configurations:
# Set Parameters
# MQTT connection Params
server = '' # MQTT Broker Address
port = 1883 # MQTT Broker Port (default is 1883)
user = '' # MQTT Broker Username
passw = '' # MQTT Broker Password
zanzitoDevice = '' # Name you gave your device in Zanzito settings
Make sure to replace the empty strings (‘’) with your actual MQTT server address,
port, username, password, and the name of your Zanzito device.
Now, run the code to check that everything is working correctly. To do this, enter the
following command:
python3 smssendr.py
The output on the screen should resemble the following:
Once set up, you can use a web interface to send SMS messages. Simply enter the
recipient’s phone number, compose your message, and hit “Send SMS.”
Congratulations! You now have your own SMS gateway up and running, ready to
send messages whenever you need.
Summary
In this comprehensive guide, we’ve shown you how to build your own SMS gateway
step by step. By setting up an MQTT server, installing the Zanzito application,
checking the system, and creating a microservice, you can send SMS messages
efficiently and cost-effectively. This DIY solution is perfect for receiving alerts and
notifications from various systems, making your life more convenient and
connected.
Sms Mqtt Flask Zanzito DIY
Follow
Written by Tomer Klein
79 Followers
🚀
🌟
C#/Python Developer crafting IoT magic, fueled by open source passion. Smart homes whisperer, code
contributor, and tech explorer.
More from Tomer Klein
Tomer Klein
Docker-Compose and Mosquitto MQTT: Simplifying Broker Deployment
Introduction
2 min read · Oct 22, 2023
19 1
Tomer Klein
NTP Server on Docker: Keeping Your Devices in Perfect Sync
Introduction
3 min read · Oct 24, 2023
20
Tomer Klein
Real-time Uptime Monitoring with Uptime Kuma and Grafana
Introduction
4 min read · Nov 23, 2023
88
Tomer Klein
Securely Access Remote Servers with Cloudflare Tunnel: A How-To Guide
Introduction
4 min read · Nov 2, 2023
See all from Tomer Klein
Recommended from Medium
Artturi Jalli
I Built an App in 6 Hours that Makes $1,500/Mo
Copy my strategy!
· 3 min read · Jan 23, 2024
8.3K 111
Akhilesh Mishra
You should stop writing Dockerfiles today — Do this instead
Using docker init to write Dockerfile and docker-compose configs
5 min read · Feb 8, 2024
1.7K 19
Lists
Medium's Huge List of Publications Accepting Submissions
262 stories · 1920 saves
Natural Language Processing
1202 stories · 679 saves
Paul Phoenix
6 Legit Apps To Make Truly Passive Income By Having Your Computer
Turned On.
Discover how to earn passive income by simply leaving your computer running. Here are six
methods that can help you monetize your idle…
9 min read · Jan 20, 2024
2.1K 40
Oliver Foster in Stackademic
What’s the Difference Between localhost and 127.0.0.1?
My article is open to everyone; non-member readers can click this link to read the full text.
· 8 min read · Feb 1, 2024
1K 8
Jason Roell
Ultimate Python Cheat Sheet: Practical Python For Everyday Tasks
This Cheat Sheet was born out of necessity. Recently, I was tasked with diving into a new
Python project after some time away from the…
33 min read · Jan 29, 2024
1.2K 20
Nikhil Vemu in Mac O’Clock
iOS 17.4 Is Way Bigger Than We’ve Expected — 25+ Amazing Features!
I’ve never felt so sad for Apple.
· 16 min read · Feb 10, 2024
2K 25
See more recommendations