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

Published  November 27, 2024   0
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. 

Disclaimer: At the time of writing this article our cloud platform is functional but yet to have some cosmetic updates. We intend to build it with time and add more functionalities

Process of Signing into Circuit Digest Cloud Account

Step 1: Visit the Circuit Digest Cloud Home Page. Click the "Login" button located at the top right corner to be redirected to the login page.

Step 2: If you already have an account, log in using your existing credentials. If not, go to the registration page to create an account by filling in the required details. Once completed, click "Register Now" to sign up.

Step 3: After registering, use your email ID and password to log in on the login page.

Process of Generating API Key

Step 4: Once logged in, click on "My Account" at the top right corner.

Step 5: You will be directed to a page where you can generate your API Key. Enter the captcha text in the provided box, then click the "Submit" button.

Step 6: If the captcha is correct, you'll see a table displaying your API Key along with its expiration date and usage count. Currently, there is a limit of 100 calls per month. Once you reach this limit, you can generate another key, giving you an additional 100 calls. This usage limit is in place to prevent abuse of our free service.

Step 7: In order to send an SMS to a phone number you should first link it with your account. To do that enter your 10-digit phone number in the “Link Phone Number” text box, solve the captcha, and click on get OTP

Step 8: A 4-digit OTP will be delivered to your phone number, which you can enter and verify OTP. If done correctly you will see the new phone number appearing on your profile page under the Linked Phone Numbers section. 

Now you can send an SMS to this phone number using our API. In order to send an SMS you have select one of the SMS formats from below. 

SMS Templates for CircuitDigest SMS API:

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 realated to this Article?

Ask Our Community Members