Send SMS from AngularJS Web App using Ozeki sms Gateway

361 Views Asked by At

I want to send SMS from AngularJS web application using Ozeki sms gateway. Can anyone tell me how to do this? pr suggest me some reference link or code sample.

1

There are 1 best solutions below

0
On

Plain sending

Assume we skipping other protocols available inside Ozeki Sms NG product (like SMPP, Email, DB etc), and getting to HTTP protocol only, you can go this way:

Prerequisites:

  1. Figure out best way for you to make HTTP request to send SMS (I'm not AngJS guy so may be there are already few ways to make HTTP-request from Angular, but at least any Ajax method passing params to executing PHP-script for making HTTP request (with curl, file_get_contents) will be totally Ok).

  2. Make sure your Ozeki SMS server is reacheable via IP/domainname etc by your PHP-script so your code can reach its endpoint.

Doing it:

Inside Ozeki install service provider like HTTP Client http://www.ozekisms.com/index.php?owpn=195&info=service-provider-connections/http-client-connection

or HTTP Server (more powerful version of HTTP Client allowing call back URLs) http://www.ozekisms.com/index.php?owpn=197&info=service-provider-connections/http-server-connection

Then according (to docs) execute request like

http://server_ip:9501/api?action=sendmessage&username=________&password=________&originatior=__________________&recipient=__________________&messagetype=SMS:TEXT&messagedata=______________

*Some fields are not necessary, it may vary depending on Ozeki version you use.

** port 9501 - is a default Ozeki HTTP port which may be changed in general settings, also it has HTTPS port as well. Basically the correct port is the same which you already use when accessing Ozeki Web GUI.

After executing sending request (try from browser or from something like Postman first) you should get responce in XML format informing you about result of your transaction.

Possible next step... DLRs

Getting delivery reports (if supported by your operator) is a common "i want it too" question.

In case you need them - there is great embedded feature inside "HTTP Server" connector (mentioned above).

Here you can see more details http://www.ozekisms.com/index.php?owpn=431

"reporturl" - is a field you may use to set kind of "call back url". In other words in this optional field you may specify full URL and list fields to be passed along. So you only have to create your own endpoint to catch them (as GET request from Ozeki server) and use inside your software.