diff --git a/docs/documentation.md b/docs/documentation.md index aceb8be..68c2e92 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -6,7 +6,7 @@ Sparrow SMS receives requests via a single standard endpoint as below: **URL** : [api.sparrowsms.com/v2](http://api.sparrowsms.com/v2) -# 1.Outgoing +# 1. Outgoing Our outgoing API enables you to send sms, get credits details. ## i. Send SMS @@ -18,3 +18,8 @@ Outgoing or Push or MT (Mobile Terminated) messages are sent from Sparrow SMS Ga Check available, consumed credits in Sparrow SMS account [**Check documentation **](/outgoing_credits/) + +# 2. Incoming +Our incoming API enables you to recieve sms, process request and reply back with reply. + +[**Check documentation **](/incoming/) \ No newline at end of file diff --git a/docs/examples_incoming.md b/docs/examples_incoming.md index 36e37d3..02055ad 100644 --- a/docs/examples_incoming.md +++ b/docs/examples_incoming.md @@ -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); + + +``` diff --git a/docs/incoming.md b/docs/incoming.md new file mode 100644 index 0000000..ab1cee8 --- /dev/null +++ b/docs/incoming.md @@ -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/) \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index f323f45..a276df4 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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: marketing@janakitech.com** +**Phone: 01-5522942 / 9802005008** +__ __ + [Check the latest API Documentation](documentation) [Jump to Examples](examples) \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 4e58f15..6fd075b 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -12,6 +12,8 @@ pages: - ['documentation.md', 'Documentation'] - ['outgoing_sendsms.md', 'Push SMS (MT)'] - ['outgoing_credits.md', 'Credits'] + - ['incoming.md', 'Pull SMS (MO)'] - ['examples.md', 'Examples'] - ['examples_outgoing.md', 'Push SMS (MT) Examples'] - ['examples_credits.md', 'Credits Examples'] + - ['examples_incoming.md', 'Pull SMS (MO) Examples'] \ No newline at end of file