Edit HTML page to store details of SMS in Database

Edit HTML page to store details of SMS in Database SearchSearch
Author Message
Sandy D'Costa
New member
Username: Sandydc

Post Number: 5
Registered: 03-2009
Posted on Saturday, April 04, 2009 - 05:00 am:   

Hiii
I want to modify html pages to store details of sms in database.Is it possible to do it?
If possible then where I will put that function in HTML page "Send Text Message.htm".
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 660
Registered: 08-2008
Posted on Monday, April 06, 2009 - 04:55 pm:   

Hi Sandy,

You could edit "Send Text Message.htm" and include an "onsubmit" Javascript function that interfaced with your database.

But I probably wouldn't do it that way for a couple of reasons.

One reason is because it would only catch messages submitted via that particular web form.

And the second reason is that it would rely on Javascript being enabled in the browser.

My suggestion would be that you take a look at the SMS Accounting callback interface.

With the accounting callback interface, you can configure a URL that gets called every time a user submits a message. This callback receives all of the details about any submitted messages. And you can use this callback to determine whether or not to allow the message to be sent.

The following link explains the basics of the SMS Accounting callbacks:

http://www.nowsms.com/support/bulletins/tb-nowsms-001.htm

However, that link is about 6 years old, and doesn't describe all of the information included in the callbacks. Back then, the content of the SMS message was not included in the callback ... but it has been included now for several years.

The following link talks about a new accounting feature that is used to control SMS message routing:

http://blog.nowsms.com/2009/01/dynamic-sms-message-routing-with-http.html

... while the information about the SMS message routing information is not relevant to your question, I point out this link because it explains all of the parameters passed to the SMS accounting callbacks in current NowSMS releases, you can see an example of what the callback looks like.

Basically, when a message is submitted, the first callback that you get contains "PreAuth=Yes", like this:

http://server.name/path?PreAuth=Yes&Type=SMSSend&From=UserAccount&To=%2B44777777 7777&MsgCount=1&SubmitIP=127.0.0.1&Text=This%20is%20a%20test.

In that callback, you have the option to reject the message. If you don't need that capability, ignore this callback.

When NowSMS accepts the message, it issues another callback:

http://server.name/path?Type=SMSSend&From=UserAccount&To=%2B447777777777&SubmitI P=127.0.0.1&Text=This%20is%20a%20test.

That second callback is the one that you'd be looking for to record this information.

Initially, you will want your script to only process messages if "Type=SMSSend". Ignore any other "Type=" values and simply return a blank OK response.

Also, ignore any callbacks when "PreAuth=Yes" ... or at least don't record these callbacks to your database. This is just NowSMS asking for permission to accept the message ... a second callback without the "PreAuth=Yes" flag will occur when NowSMS accepts the message.

--
Des
NowSMS Support