-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from manishmodi/master
Adding incoming documentation
- Loading branch information
Showing
5 changed files
with
112 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,54 @@ | ||
# Examples (Incoming SMS) | ||
|
||
## Php | ||
|
||
``` | ||
// STEP 1 | ||
// incoming request parameters | ||
$from = $_GET["from"]; // sms sender | ||
$to = $_GET["to"]; // shortcode | ||
$keyword = $_GET["keyword"]; // first word | ||
$text = $_GET["text"]; // the complete text | ||
$timestamp = time(); | ||
// STEP 2 | ||
// build your logic on how to respond the incoming request | ||
switch($keyword){ | ||
case "one": | ||
$reply = "You (". $from .") have been subscribed to campaign one"; | ||
break; | ||
case "two": | ||
$reply = "You (". $from .") have been subscribed to campaign two"; | ||
break; | ||
default: | ||
$reply = "Invalid campaign name"; | ||
break; | ||
} | ||
// STEP 3 | ||
// may be you need to save the request to your own database | ||
// @optional | ||
mysql_connect("localhost", "username", "password"); | ||
mysql_select_db("sparrow_sms"); | ||
mysql_query("insert into logs_incoming | ||
(`from`, `to`, `keyword`, `text`, `timestamp`) | ||
values ('".mysql_real_escape_string($from)."', | ||
'".mysql_real_escape_string($to)."', | ||
'".mysql_real_escape_string($keyword)."', | ||
'".mysql_real_escape_string($text)."', | ||
'".$timestamp."' | ||
)"); | ||
// STEP 4 | ||
// send reply back to Sparrow SMS | ||
// This has to be STRICTLY 160 chars (max) | ||
die($reply); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Receive SMS / Incoming / Pull / MO (Mobile Originated) | ||
|
||
##Shortcode | ||
Shortcode is four digit number to which user can send SMS from any telecom. Benefits of Shortcodes are: | ||
1. Easy to remember | ||
2. Provides direct connectivity to Telecom | ||
3. Shortcode can have different tarrifs like (Rs. 1-5) | ||
|
||
## Keyword | ||
First word of SMS sent by user is Keyword, it is used to identify the action / service requested. | ||
|
||
## Sub Keyword | ||
Second Keyword of SMS sent by user is called Sub Keyword. Its optional and depends upon the campaign | ||
|
||
|
||
## Parameters | ||
|
||
**_Settings_** | ||
``` | ||
URL : Public URL where the incoming SMS has to be forwarded. | ||
Keyword : Keyword that has to be forwarded. | ||
Shortcode : Shortcode to which, user has to send SMS. | ||
Default Reply : Default response that has to be sent to user, | ||
incase request to url fail. | ||
``` | ||
|
||
**_Request_** | ||
|
||
``` | ||
GET request is sent to the URL provided with following arguments: | ||
from : Subscribers number sending SMS. | ||
to : Shortcode to which subscriber has sent SMS. | ||
text : Complete SMS sent by user. | ||
keyword : Keyword of SMS sent. | ||
``` | ||
|
||
## Response | ||
URL must process the request and send text response of maximum 160 characters with status code 200 or 202. Incase of any other response code, default reply will be sent to user as SMS reply. | ||
|
||
[**Proceed to examples**](/examples_incoming/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,11 @@ Sparrow SMS provides both **MT** and **MO** APIs and supports with integration w | |
|
||
`(Version 2.0)` API supports RESTFUL support. | ||
|
||
##Contact Details: | ||
**Email: [email protected]** | ||
**Phone: 01-5522942 / 9802005008** | ||
__ __ | ||
|
||
[Check the latest API Documentation](documentation) | ||
|
||
[Jump to Examples](examples) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters