This C# sms library enables you to send and receive from Javascript with http requests. The library uses HTTP Post requests and JSON encoded content to send the text messages to the mobile network. It connects to the HTTP SMS API of Ozeki SMS gateway.
The Ozeki SMS Gateway is a powerful yet easy to master gateway software. It is very reliable, and it runs in an environment controlled by the user. It means that it offers outstanding safety for your data. It provides an HTTP SMS API, that allows you to connect to it from local or remote programs. The reason why companies use Ozeki SMS Gateway as their first point of access to the mobile network, is because it provides service provider independence and direct access to the mobile network through wireless connections.
Download: Ozeki SMS Gateway download page
Tutorial: Javascript send sms sample and tutorial
- Download Ozeki SMS Gateway
- Connect Ozeki SMS Gateway to the mobile network
- Create an HTTP SMS API user
- Download and Install WampServer
- Download then extract the SendSms.js.zip file
- Put the contents of the zip file into the \www\ folder of the wampserver: C:\wamp64\www
- Launch Ozeki SMS Gateway app
- Open the website by typing http://localhost/SendSms.php into your browser
- Send the SMS 10.Check the logs to see if the SMS sent
In order to use the Ozeki.Libs.Rest library in your own project, you need to place the Ozeki.Libs.Rest.js file in your project. After you've placed this file (what you can download from this github repository, together with 5 example projects), you can import its components with this line:
import { Configuration, Message, MessageApi } from 'Ozeki.Libs.Rest.js';
When you imported these three components, you are ready to use the Ozeki.Libs.Rest library, to send, mark, delete and receive SMS messages.
To send your SMS message to the built in API of the Ozeki SMS Gateway, your client application needs to know the details of your Gateway and the http_user. We can define a Configuration instance with these lines of codes in JavaScript.
var configuration = new Configuration();
configuration.Username = 'http_user';
configuration.Password = 'qwe123';
configuration.ApiUrl = 'http://127.0.0.1:9509/api';
After you have initialized your configuration object you can continue by creating a Message object. A message object holds all the needed data for message what you would like to send. In JavaScript we create a Message object with the following lines of codes:
var msg = new Message();
msg.ToAddress = '+36201111111';
msg.Text = 'Hello world!';
You can use the MessageApi class of the Ozeki.Libs.Rest library to create a MessageApi object which has the methods to send, delete, mark and receive SMS messages from the Ozeki SMS Gateway. To create a MessageApi, you will need these lines of codes and a Configuration instance.
var api = new MessageApi(configuration);
After everything is ready you can begin with sending the previously created Message object:
var result = await api.Send(msg);
console.log(result);
After you have done all the steps, you check the Ozeki SMS Gateway and you will see the message in the Sent folder of the http_user.
To get a better understanding of the above SMS code sample, it is a good idea to visit the webpage that explains this code in a more detailed way. You can find videos, explanations and downloadable content on this URL.
Link: How to send sms from Javascript
If you wish to send SMS through your Android mobile phone from C#, you need to install Ozeki SMS Gateway on your Android mobile phone. It is recommended to use an Android mobile phone with a minimum of 4GB RAM and a quad core CPU. Most devices today meet these specs. The advantage of using your mobile, is that it is quick to setup and it often allows you to send sms free of charge. Android SMS Gateway
Don't waste any time, download the repository now, and send your first SMS!