40 likes | 118 Views
Before integrating an API, there are a few important things that you need to know. good SMS API service provider , Copy the codes of integration and many more
E N D
How To Integrate SMS API In Python? When it comes to developing an API and then necessarily to channelize it across platforms, you want the trust and simplicity of a trusted platform where you can easily get the codes from, and then use the codes in order to integrate it with your server. SMS API helps in a number of ways. It streamlines the productivity of an application, helps send bulk SMS to targeted customers, uncomplicated the entire process of communication, eases the order and bulk system. An SMS API acts as a gateway of sending and receiving SMS thereby simplifying the entire method of communication. In Order To Integrate SMS API In Python? There are ranges of ways you can easily integrate SMS API in Python. Before using any SMS gateway, you need to focus on a few important things. Just ensure to visit a trusted and popular API and SMS gateway service provider.
Python is a sophisticated, universal, powerful programming language. The easy and simple syntax make Python a great language easy to experiment. It is simple and easy to integrate an API in Python. As we mentioned earlier, before integrating an API, There are a few important things that you need to know; some of which include - Visiting the website of a good SMS API service provider Copy the codes of integration Paste the code on your server Test the results and thereby based on result, integrate the codes BroadNet is one of the trusted SMS gateway service providers. You just need to copy the following code and paste it on the server before testing class SmsAPI(object): # <summary> # Specify complete Url of SMS gateway # </summary> def get_ApiUrl(self): def set_ApiUrl(self, value): ApiUrl = property(fget=get_ApiUrl, fset=set_ApiUrl) # <summary> # User name supplied by provider # </summary> def get_user(self): def set_user(self, value): user = property(fget=get_user, fset=set_user) # <summary> # Password supplied by provider # </summary> def get_pass(self): def set_pass(self, value): pass = property(fget=get_pass, fset=set_pass) # <summary> # SID supplied by provider # </summary> def get_sid(self): def set_sid(self, value): sid = property(fget=get_sid, fset=set_sid) def __init__(self, ApiUrl, user, pass, sid): self.ApiUrl = ApiUrl
self.user = user self.pass = pass self.sid = sid def __init__(self, ApiUrl, user, pass, sid): self.ApiUrl = ApiUrl self.user = user self.pass = pass self.sid = sid def SendSMS(self, Recipient, MessageData): if self.ApiUrl.Trim() == "" or self.user.Trim() == "" or self.pass.Trim() == "" or self.sid.Trim() == "": raise Exception("All Properties were required") #Status = SMS(User, SURL, SPort, Passw, number, MessageData, MessageType); //Sending SMS #string createdURL = "http://78.108.164.67" + ":" + "8080" + "/websmpp/websms" + #"?user=" + "SPDDLC" + #"&pass=" + "s@KJ8QH9" + #"&sid=" + "SPDDLC" + #"&mno=" + Recipient + #"&text=" + MessageData + #"&type=" + "1" + #"&esm=" + "0" + #"&dcs=" + "0"; # MessageBox.Show(createdURL); createdURL = self.ApiUrl + "?user=" + self.user + "&pass=" + self.pass + "&sid=" + self.sid + "&mno= " + Recipient + "&text=" + MessageData + "&type=" + "1" + "&esm=" + "0" + "&dcs=" + "0" try: myReq = WebRequest.Create(createdURL) #MessageBox.Show("2"); # Get response from SMS Gateway Server and read the answer myResp = myReq.GetResponse() # MessageBox.Show("21"); respStreamReader = System.IO.StreamReader(myResp.GetResponseStream()) # MessageBox.Show("22"); responseString = respStreamReader.ReadToEnd() # MessageBox.Show("2"); respStreamReader.Close() myResp.Close() except Exception, ex: raise ex finally: return "success" This is the simplest and quickest way to easily integrate the API. About the Author BroadNet Technologies is an international leading Business Messaging Solution Provider. It’s joined the GSMA as an Associate Member also it has been awarded certification to the ISO 27001:2013; BroadNet Technologies has been a pioneer in the use of SMS- messaging service across global markets since 2003 thus widening its range of products and services to include Bulk SMS, A2P SMS, HLR Lookup, SMSC Gateway, SMS Firewall, Web Solutions, and Mobile Applications.