Last active
February 2, 2026 12:20
-
-
Save CircuitDigest/94b40dbd6091dffba861d06a46ddcfb4 to your computer and use it in GitHub Desktop.
Python Code to test CircuitDigest SMS API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| # Define the API endpoint and API key | |
| api_key = "your_api_key_here" | |
| url = "https://www.circuitdigest.cloud/api/v1/send_sms?ID=101" | |
| # Set the payload with the recipient's mobile number and dynamic variables | |
| payload = { | |
| "mobiles": "919876543210", # Replace with recipient's mobile number | |
| "var1": "John Doe", # Replace with your first variable | |
| "var2": "Your package is ready." # Replace with your second variable | |
| } | |
| # Set the headers with the API key | |
| headers = { | |
| "Authorization": api_key, | |
| "Content-Type": "application/json" | |
| } | |
| # Send the POST request | |
| response = requests.post(url, headers=headers, json=payload) | |
| # Handle the response | |
| if response.status_code == 200: | |
| print("SMS sent successfully!") | |
| print("Response:", response.json()) | |
| else: | |
| print("Failed to send SMS. Status code:", response.status_code) | |
| print("Error:", response.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment