Skip to content

tahaafarooq/vonage-api-sms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

vonage-api-sms

A simple wrapper for the vonage SMS API

Installation

~$ git clone https://github.com/tahaafarooq/vonage-sms-api
~$ cd vonage-sms-api
vonage-sms-api/~$ pip3 install -r requirements.txt
vonage-sms-api/~# python3 setup.py install

Configuration

create a .env file in the path where you shall run your project, the file should contain the following:

API_KEY=xxxxxxxx
API_SECRET=xxxxxxxxxxxx

Sending Single SMS

from vonage_sms_api.vonager import VonageSMSApi

# sending single SMS

receiver = input("Enter Phone Number : ")
message = input("Enter Message : ")

vonage_object = VonageSMSApi()
send = vonage_object.send_sms(receiver, message)

print(send)
Enter Phone Number : XXXXXXXXX
Enter Message : hello
[{'to': 'XXXXXXXXX', 'message-id': 'XXXXXX', 'status': '0', 'remaining-balance': '1.04000000', 'message-price': '0.12000000', 'network': 'XXXXX'}]
Message Sent Successfully

Sending Bulk SMS

from vonage_sms_api.vonager import VonageSMSApi

# sending bulk SMS

numbers = input("Enter Phone Numbers Seperated by Comma : ")
msisdns = numbers.split(',')
msisdns = [msisdn.strip() for msisdn in msisdns]

message = input("Enter message to send")

print(msisdns)

vonage_object = VonageSMSApi()
send = vonage_object.send_bulk_sms(msisdns, message)

print(send)

About

A simple wrapper for the vonage SMS API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages