2 way sms with mobile number database building

2 way sms with mobile number database building SearchSearch
Author Message
Lance Tan
New member
Username: Lance9

Post Number: 1
Registered: 07-2011
Posted on Friday, July 22, 2011 - 12:23 pm:   

Hi,

I just need a simple 2 way reply like :

1. Sender send define keyword "Save"
2. System reply simple text "Present this sms coupon to get 10% off your bill!"
3. I want the sender mobile to be automatically stored into a list of database (.txt or excel or any other) as I will want to braodcast promotions to them in future for my restaurants.

How am I able to do that as I the documentation in nowsms website for 2-way is not detailed enough for a newbie like myself.. Please assist thanks.. I am a serious buyer, I just wanna make sure I can make the trial work properly for my business before I buy full license.

Can someone give me a step by step guide for my requirement? Thanks!
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 3356
Registered: 08-2008
Posted on Saturday, July 23, 2011 - 02:02 am:   

Hi Lance,

I'm assuming you have some experience with web development (otherwise I wouldn't know where to start).

If you can process data from a web page form, that's basically the same procedure you use to process a received SMS.

If you think about a web form, the form has a target script/URL that receives the form parameters that the user supplied. Each field in your form is a passed to your script via a field name parameter.

It might be easier to think of a NowSMS 2-way command as something that converts the received text message into a form that is posted to your script.

For simplicity, NowSMS uses a form method of "GET" instead of "POST".

Let's say you have a 2-way command configured to call http://server/2way.php?sender=@@SENDER@@&text=@@FULLSMS@@

NowSMS is taking the received text message and converting it to a form to be posted to your script. The sender address of the text message is in the "sender" variable, and the text of the message is in the "text" variable.

Here's an example of what 2way.php could look like as a PHP script:


<?php
header ("Content-Type: text/plain");

if (isset($_REQUEST['sender'])) {
if (isset($_REQUEST['text'])) {
echo "I recieved your message : " . $_REQUEST['text'];
}
else {
echo "ERROR : 'text' parameter missing\r\n";
}
}
else {
echo "ERROR : 'sender' parameter missing!\r\n";
}

?>

If you wanted to store the data to a database, you would take the values of $_REQUEST['sender'] and $_REQUEST['text'] and store them.

If you wanted to look for certain values in the text, then you could get more sophisticated in your script.

This example assumes that the 2-way script is configured in NowSMS with the option "Command returns response text". This means that NowSMS looks for whatever text you echo back and sends it as a response.

If you uncheck that option, you can also use the SendSMS function here to send a message: http://www.nowsms.com/nowsms-php-example-send-sms-text-message

While you could certainly save the information to an external database, we also have some PHP examples to add/remove the sender from built-in NowSMS distribution lists. That is more involved, but if you're familiar with PHP, the following is a good starting point:

http://www.nowsms.com/sms-distribution-lists-with-php

--
Des
NowSMS Support