Free SMS API for Arduino R4, NodeMCU, ESP32, Raspberry Pi, and other Embedded SoC Boards (India Only)

Published  December 24, 2024   4
User Avatar Aswinth Raj
Author
How to send free text messages using Arduino, NodeMCU ESP32 etc

At CircuitDigest, we've been creating and sharing Internet of Things (IoT) projects with our community for a long time. A crucial part of these projects is enabling communication between IoT devices and end users, and when it comes to simple notifications, nothing beats the practicality of sending an SMS.

However, sending an SMS from devices like Arduino, ESP32, or other embedded systems typically requires a GSM module with a working SIM card. While this method is valid, it has its drawbacks:
1.    Outdated 2G Networks: Popular modules like SIM800 are becoming obsolete since major telecom providers have phased out 2G services (at least in India).
2.    Cost and Complexity: Using 3G or 4G GSM modules increases costs, power consumption, and project complexity.
3.    Scalability: Sending SMS from a single device is straightforward, but scaling this for multiple devices can become cumbersome.

An ideal solution would be to use an SMS API, which is why we created the CircuitDigest Cloud SMS API. After extensive research and community feedback, we found that existing SMS services were often too complex or not tailored for hobbyists and engineers working on early prototypes. This is where our SMS API comes in—easy to use, free, and designed specifically for makers in India.

What is CircuitDigest Cloud?

CircuitDigest Cloud is an initiative aimed at empowering engineers, makers, and hobbyists with essential tools for rapid prototyping. In addition to the SMS API, we also offer other useful APIs, such as QR Code Scanning and License Plate Recognition, for those interested in expanding their projects.

How to Send SMS Using CircuitDigest Cloud API?

Using the SMS API from CircuitDigest you can easily send SMS from your IoT Development boards like Arduino R4, ESP32, ESP8266, Raspberry Pi etc. It is as simple as creating an account on circuitdigest.cloud, registering your mobile numbers and using any of the pre-defined SMS templates to send a message of your choice. 

Currently this service is available only for the users in India, and each user can send a maximum of 100 SMS/month for free which we believe will be enough for most practical applications. In order to prevent spamming we have made sure that users can send SMS only numbers that are already linked to their account using a OTP verification. 

Generating API Key

We first want to generate a valid SMS API from the Circuit Digest Cloud SMS service provider, so that we can make our ESP32 send SMS by utilizing the power of the internet.

STEP 1:  Visit our Circuit Digest Cloud website “https://www.circuitdigest.cloud/”. Then click on the login button. It will redirect you to the login page, there you just enter your login credentials. If you don’t have an account, create a new one using the Register Page.

Circuit Digest Cloud Login Page

STEP 2: After logging in, you will find the “Account” button in the top-right corner. Click on it to view a dropdown menu with options such as Profile, API Key, and Logout. Select API Key, and you will be redirected to the API key generation page.

Circuit Digest Cloud API Key Login Page

STEP 3: On the API Key generating page, a new API key will be generated with a limit of 100 SMS per month. Even after Expiry, you can renew it for free of cost.

Here, you can obtain the API key. Simply copy it and use it in your code for further use.

STEP 4:  After that, scroll down the webpage until you find the SMS Notification API section. Click on "View Details" to proceed.

Select view Details on SMS Notification API on Page

Step 5: In the SMS Notification API tab, you will find the "Link Phone Number" option. Click on it to link a phone number for sending SMS notifications.

Selecting Link Phone Number Option

STEP 6:  Enter the phone number you want to link and click the "Get OTP" button. You will receive an OTP on the entered number enter the OTP to verify the phone number. Once verified, you can also view the list of linked phone numbers here.
 

 Linking The Phone CD SMS API

After OTP verification, the phone number will be linked successfully. You can link up to 5 phone numbers to your account.

 

Prebuilt SMS Template of Circuit Digest Cloud

Template IDTemplate TypeMessage
101Device Status AlertYour {#var#} is currently at {#var#}.
--
Powered by CircuitDigest for the Engineers and Makers of India. Visit www.circuitdigest.com.
102Temperature AlertThe temperature in {#var#} has reached {#var#}°C. Please take necessary action.
--
Powered by CircuitDigest for the Engineers and Makers of India. Visit www.circuitdigest.com.
103Motion DetectedMotion detected by {#var#} in the {#var#}. Investigate immediately.
--
Powered by CircuitDigest for the Engineers and Makers of India. Visit www.circuitdigest.com.
104Battery Low AlertThe battery level of {#var#} is critically low at {#var#}%. Recharge immediately.
--
Powered by CircuitDigest for the Engineers and Makers of India. Visit www.circuitdigest.com.
105Periodic ReminderYour {#var#} is currently at {#var#}.
--
Powered by CircuitDigest for the Engineers and Makers of India. Visit www.circuitdigest.com.
106Service ReminderIt’s time to service your {#var#}. Last service was on {#var#}.
--
Powered by CircuitDigest for the Engineers and Makers of India. Visit www.circuitdigest.com.
107Error NotificationError {#var#} has been detected in {#var#}. Please troubleshoot immediately.
--
Powered by CircuitDigest for the Engineers and Makers of India. Visit www.circuitdigest.com.
108Door/Window StatusThe {#var#} is currently {#var#}. Please ensure safety.
--
Powered by CircuitDigest for the Engineers and Makers of India. Visit www.circuitdigest.com.
109System RebootThe system {#var#} has been rebooted at {#var#}. Verify functionality.
--
Powered by CircuitDigest for the Engineers and Makers of India. Visit www.circuitdigest.com.
110Location TrackingThe device {#var#} is currently located at {#var#}.
--
Powered by CircuitDigest for the Engineers and Makers of India. Visit www.circuitdigest.com.
111Task CompletionThe task {#var#} has been successfully completed at {#var#}.
--
Powered by CircuitDigest for the Engineers and Makers of India. Visit www.circuitdigest.com.
112Connection Lost AlertThe connection with {#var#} was lost at {#var#}. Please check the network or device.
--
Powered by CircuitDigest for the Engineers and Makers of India. Visit www.circuitdigest.com.
113Maintenance NeededThe {#var#} requires maintenance. Detected issue: {#var#}.
--
Powered by CircuitDigest for the Engineers and Makers of India. Visit www.circuitdigest.com.
114Overload AlertThe {#var#} is experiencing an overload. Current load: {#var#}. Please reduce usage.
--
Powered by CircuitDigest for the Engineers and Makers of India. Visit www.circuitdigest.com.
115Unauthorized AccessUnauthorized access detected in {#var#} at {#var#}. Verify immediately.
--
Powered by CircuitDigest for the Engineers and Makers of India. Visit www.circuitdigest.com.

As you can see the above table shows the most commonly used 15 SMS templates, with a template ID. Each template has two variables marked at {#var#} whoes value can be passed from the development board in real time. In order to call this SMS API the user has to send the following four values

1.    API Key: Can be obtained from circuitdigest cloud profile page 
2.    SMS Template ID: Can be selected form the table above
3.    Variable 1: You can pass up to 30 alphanumeric characters, excluding special characters
4.    Variable 2: You can pass up to 30 alphanumeric characters, excluding special characters

 

API Endpoint

Base URL: https://www.circuitdigest.cloud/send_sms 
HTTP Method: POST
Query Parameter ID: The Template ID of the SMS (e.g., 101)
Headers Authorization: API key for secure access.
Content Type: application/json

Request Body:

The API expects a JSON payload with the following fields:

Field

Type

Description

mobiles

String

The recipient's mobile number(s), prefixed with 91

var1

String

Placeholder for the first dynamic value in the template.

var2

String

Placeholder for the second dynamic value in the template.

Testing CircuitDigest SMS API using Python:

We have provided a simple Python code to send SMS using the CircuitDigest SMS API below. You can use this code to test if your API key is working as expected. Make sure to modify the below code with your actual API key, mobile number and variables of your choice before running the code

API Response

The API returns a JSON object with the request status. Below is a sample response:

Successful Response:

{
 "status": "success",
 "message": "SMS sent successfully",
 "details": {
   "mobile": "919876543210",
   "template_id": "12345",
   "delivery_status": "pending"
 }
}

Error Response:

{
 "status": "error",
 "message": "Invalid API key",
 "code": 401
}

Notes and Best Practices

1.    Mobile Number Format: Always prefix numbers with the country code (91 for India).
2.    Template Validation: Ensure the provided Template ID matches the server's configuration.
3.    Rate Limiting: Monitor usage limits and regenerate keys as needed.
4.    Error Handling: Implement robust error handling for API responses.

Common Errors

Error Code

Message

Cause

401Invalid API keyAPI key is missing or incorrect.
400Bad RequestMissing required fields in the request body.
403Rate Limit ExceededMaximum request limit reached for the API key.

More Code Examples

The API has been tested with the NodeMCU but can be used with any development boards capable of connecting to internet. We will provide links to all the tutorials using this API, complete with code and circuit diagrams, as usual.

Create and Share:

We hope this will be useful for quickly testing and deploying your ideas. If you build something using the API, please share it with us, and we will mention your work on this page. Happy building!

 

Have any question related to this Article?

Worthless outside of India.  This should be part of the working title.  js

Add New Comment

Login to Comment Sign in with Google Log in with Facebook Sign in with GitHub