This repository contains a Python script that allows you to send free SMS messages using the Yegara Host SMS Gateway. You can use this script to send OTP, notifications, alerts, and other messages from your websites and apps.
Simple python script to implement SMS API for your sites.
Visit Ethiosolve»
Yegara Documentation
Plagiarism Checker
·
Referral Programs
·
Table of Contents
This repository contains a Python script that allows you to send free SMS messages using the Yegara Host SMS Gateway
. You can use this script to send OTP, notifications, alerts, and other messages from your websites and apps. The script uses the Yegara Host API
to communicate with the SMS Gateway and requires a valid API key and sender ID. You can also use the WordPress plugin provided by Yegara Host to integrate the SMS Gateway with your WordPress site. This script is easy to use and customize, and it supports both Unicode and non-Unicode characters.
Create app.py
to get started.
- To use this script, you need to have Python 3 installed on your system and install the requests library using pip:
pip install requests
You also need to have a Yegara Host account and a domain name registered with them. You can sign up for a free account here.
First import these libraries
import random
import string
import requests
To use this script, you need to edit the following variables in the code:
username:
Your domain name registered with Yegara Host.password:
Your Yegara Host account password.to:
The phone number of the recipient in international format (e.g. +251911234567).message:
The message you want to send. If you are using a template, this will be the variable part of the message (e.g. OTP code).template_id:
The template ID of the message you want to send. You can choose from the predefined templates or create your own custom template in your Yegara Host dashboard.
The script defines two functions: generateOTP() and sendSMS(). The first function generates a random 4-digit OTP code using the random module. The second function sends an SMS message using the requests module and prints the JSON response from the server.
You can run the script from the command line or import it as a module in your own Python program. The script will generate a random OTP code and send it to the specified phone number using the ‘otp’ template. You can change the template ID or the message as per your requirement.
Template IDs
otp
otp_1
welcome
welcome_1
reminder
reminder_1
shopping
shopping_1
confirmation
confirmation_1
For more examples, please refer to the Documentation
- (https://yegara.com/sms-gateway/
- https://yegara.com/sms-api/
- https://yegara.com/free-hosting/
- LICENSE
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the Apache License. See LICENSE.txt
for more information.
Abel Zecharias - Instagram - abelzeki24@gmail.com
Project Link: https://github.com/abelzk/yegara-host-smsapi-python