Sunteți pe pagina 1din 20

SMART Messaging

Suite/NETCAST
Web Service/API Guide
Table of Contents

1 | Introduction ............................................................................................................................................ 1
About This Document....................................................................................................................... 1
Process Flow Diagram ..................................................................................................................... 1
2 | Features .................................................................................................................................................. 2
IP White-List via Web UI .................................................................................................................. 2
Conditions and Rules .......................................................................................................... 2
Connection ....................................................................................................................................... 2
Function .............................................................................................................................. 2
Parameters .......................................................................................................................... 2
Example .............................................................................................................................. 3
Return ................................................................................................................................. 3
XML Request ...................................................................................................................... 3
XML Response .................................................................................................................... 3
Send SMS ........................................................................................................................................ 4
Function .............................................................................................................................. 4
Parameters .......................................................................................................................... 4
Example .............................................................................................................................. 4
Return ................................................................................................................................. 4
XML Request ...................................................................................................................... 4
XML Response .................................................................................................................... 5
Send SMS with Opt-Out Message ................................................................................................... 5
Function .............................................................................................................................. 5
Parameters .......................................................................................................................... 5
Standard Opt-Out Message ................................................................................................ 5
Example .............................................................................................................................. 6
Return ................................................................................................................................. 6
XML Request ...................................................................................................................... 6
XML Response .................................................................................................................... 6
Request Sent SMS Status ............................................................................................................... 7
Function .............................................................................................................................. 7
Parameters .......................................................................................................................... 7
Example .............................................................................................................................. 7
Return ................................................................................................................................. 7
XML Request ...................................................................................................................... 8
XML Response .................................................................................................................... 8
Download and Request Logs ........................................................................................................... 8
Function .............................................................................................................................. 8
Parameters .......................................................................................................................... 8
Log Formats ........................................................................................................................ 8
Example .............................................................................................................................. 9
Return ................................................................................................................................. 9
XML Request ...................................................................................................................... 9
XML Response .................................................................................................................. 10
Download Incoming Messages from Smart Subscribers ............................................................... 11
Function ............................................................................................................................ 11
Parameters ........................................................................................................................ 11
Example ............................................................................................................................ 11
Return ............................................................................................................................... 11
XML Request .................................................................................................................... 11
XML Response .................................................................................................................. 12
Download Incoming Messages ...................................................................................................... 12
Function ............................................................................................................................ 12
Parameters ........................................................................................................................ 12
Example ............................................................................................................................ 12
Return ............................................................................................................................... 13
XML Request .................................................................................................................... 13
XML Response .................................................................... Error! Bookmark not defined.
3 | Error Code Per Function ..................................................................................................................... 13
4 | Error Code and Description ................................................................................................................ 15
5 | SOAP Server and Functions ............................................................................................................... 16
Server Endpoint ............................................................................................................................. 16
Full WSDL Documentation ............................................................................................................. 16
Generic Client Script ...................................................................................................................... 16
Revision History

Version Date Author Description

1.0 April 8, 2014 C. Quiros Created the document


Added new Conditions and Rules in IP
White-List via Web UI section
Updated Connection, Download
1.1 June 4, 2014 C. Quiros Incoming Non-Smart Messages, Server
Endpoint, and Full WDSL Documentation
sections.
Added Process Flow Diagram section
Removed Error Code RETEMP08
1.2 June 19, 2014 C. Quiros Updated Download Incoming Non-Smart
Messages description
Updated Download and Request Logs,
Download Incoming Messages from
1.3 July 4, 2014 C. Quiros Smart Subscribers, Download Incoming
Messages, and Error Code and
Description sections
Updated Server Endpoint, Full WSDL
1.4 July 25, 2014 C. Quiros Documentation, Connection Return and
XML Response
Updated Functions, Example(s), Return,
1.5 January 20, 2015 J. Camat XML Request, XML Response, Log
Formats and Generic Client Script.
1 | Introduction

About This Document


NETCAST V4 or will now be called as SMART Messaging Suite, is a web-based SMS
service that aims to cater corporate and organizational communication channel needs
through regular and scheduled bulk messaging.

In the development of this new version, the Web Service or API (Application Program
Interface) will be enhanced. Web Service allows you to use your own system or
application and be able to send SMS to target recipients. The said service can be
integrated to any system using HTTP-SOAP or Simple Object Access Protocol.

This API Guide discusses the features of the Smart Messaging Suite Web Service. This
document aims to help you familiarize with the functions you can use in the API.

Process Flow Diagram

SMART Messaging Suite | Web Service/API Guide 1


2 | Features

IP White-List via Web UI


This facility allows you to enroll third-party client's IP address/es that you will use to
connect to Web Service API.

Conditions and Rules


1. Only public and static IPs will be allowed.
2. The system shall validate IP.
3. All IP address should be accepted except for the following conditions:
a. Local IP (e.g. 192.168.x.x or 10.x.x.x)
b. Incomplete IP (e.g. 125.5.124, 202.163.)
c. Invalid IP (e.g. 1.0.0.0)
d. Duplicate IP
e. Maximum allowed number of IP reached
f. Unidentified network IP
4. Once IP address is approved, the registered company admin can create access to
Web service.
5. Approval of IP address is within 24 hrs, system will automatically send notification
once approved.
6. Maximum 10 IP address can be enrolled and used.

Connection
This function is used to test the connection between your application with the Web
Service.

Function
GET_CONNECT

Parameters
Assigned SmartMS ID to Client

SMART Messaging Suite | Web Service/API Guide 2


Example
<?php
$URL = "https://ws.smartmessaging.com.ph/soap/?wsdl";
$client = new soapclient($URL);
$token = "samplesmartmsid";

$method = 'GETCONNECT';
$parameters = array(
array(
'token' => $token
)
);
$return = $client->__call($method, $parameters);
?>

Return
"Welcome to Smart Messaging Suite Web Service. You are now connected to
our SOAP API Server.”

XML Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:netcast_web_service">
<soapenv:Header/>
<soapenv:Body>
<urn:GETCONNECT>
<!--Optional:-->
<urn:token>samplesmartmsid</urn:token>
</urn:GETCONNECT>
</soapenv:Body>
</soapenv:Envelope>

XML Response
<senv:Envelope xmlns:tns="urn:netcast_web_service"
xmlns:senv="http://schemas.xmlsoap.org/soap/envelope/">
<senv:Body>
<tns:GETCONNECTResponse>
<tns:GETCONNECTResult>Welcome to Smart Messaging Suite Web Service.
You are now connected to our SOAP API Server.</tns:GETCONNECTResult>
</tns:GETCONNECTResponse>
</senv:Body>
</senv:Envelope>

SMART Messaging Suite | Web Service/API Guide 3


Send SMS
This function is used to send an outgoing broadcast SMS via web service.

Function
SENDSMS

Parameters
 Destination mobile number
 Message
 SmartMS ID

Example
<?php
$URL = "https://ws.smartmessaging.com.ph/soap/?wsdl";
$client = new soapclient($URL);
$token = "samplesmartmsid";

$method = 'SENDSMS';
$parameters = array(
array(
'token' => $token,
'msisdn' => '09191234567',
'message' => 'Sample message here.'
)
);
$return = $client->__call($method, $parameters)
?>

Return
Transaction Reference Number

XML Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:netcast_web_service">
<soapenv:Header/>
<soapenv:Body>
<urn:SENDSMS>
<!--Optional:-->
<urn:token>samplesmartmsid</urn:token>
<!--Optional:-->

SMART Messaging Suite | Web Service/API Guide 4


<urn:msisdn>09191234567</urn:msisdn>
<!--Optional:-->
<urn:message>This is a test message</urn:message>
</urn:SENDSMS>
</soapenv:Body>
</soapenv:Envelope>

XML Response
<senv:Envelope xmlns:tns="urn:netcast_web_service"
xmlns:senv="http://schemas.xmlsoap.org/soap/envelope/">
<senv:Body>
<tns:SENDSMSResponse>
<tns:SENDSMSResult>1422</tns:SENDSMSResult>
</tns:SENDSMSResponse>
</senv:Body>
</senv:Envelope>

Note Maximum message length is 420 characters only.

Send SMS with Opt-Out Message


This function is used to send broadcast SMS with opt-out message, an instructional SMS
on how to the recipient can exclude himself/herself from receiving future message
broadcasts.

Function
SENDSMSOPT

Parameters
 Destination mobile number
 Message
 SmartMS ID

Standard Opt-Out Message


“To stop receiving messages, text STOP <MASK> to 392 for SMART and
09088968278 for other networks. Standard text messaging rates apply.”

SMART Messaging Suite | Web Service/API Guide 5


Example
<?php
$URL = "https://ws.smartmessaging.com.ph/soap/?wsdl";
$client = new soapclient($URL);
$token = "samplesmartmsid";

$method = 'SENDSMSOPT';
$parameters = array(
array(
'token' => $token,
'msisdn' => '09191234567',
'message' => 'Sample message here.'
)
);
$return = $client->__call($method, $parameters);
?>

Return
Transaction Reference Number

Note Opt-out message is hard-coded.

XML Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:netcast_web_service">
<soapenv:Header/>
<soapenv:Body>
<urn:SENDSMSOPT>
<!--Optional:-->
<urn:token>samplesmartmsid</urn:token>
<!--Optional:-->
<urn:msisdn>09191234567</urn:msisdn>
<!--Optional:-->
<urn:message>Sample message here.</urn:message>
</urn:SENDSMSOPT>
</soapenv:Body>
</soapenv:Envelope>

XML Response
<senv:Envelope xmlns:tns="urn:netcast_web_service"
xmlns:senv="http://schemas.xmlsoap.org/soap/envelope/">

SMART Messaging Suite | Web Service/API Guide 6


<senv:Body>
<tns:SENDSMSOPTResponse>
<tns:SENDSMSOPTResult>1424</tns:SENDSMSOPTResult>
</tns:SENDSMSOPTResponse>
</senv:Body>
</senv:Envelope>

Note Maximum message length is 420 characters only.

Request Sent SMS Status


This function is used to check the status of the message sent if it is pending, successful,
failed or unable to send.

Function
GETMSGSTATUS

Parameters
 Transaction reference number
 SmartMS ID

Example
<?php
$URL = "https://ws.smartmessaging.com.ph/soap/?wsdl";
$client = new soapclient($URL);
$token = "samplesmartmsid";

$method = 'GETMSGSTATUS';
$parameters = array(
array(
'token' => $token,
'transaction_id' =>'30384'
)
);
$return = $client->__call($method, $parameters);
?>

Return
Status of referenced message (please see Summary section for further
details)

SMART Messaging Suite | Web Service/API Guide 7


XML Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:netcast_web_service">
<soapenv:Header/>
<soapenv:Body>
<urn:GETMSGSTATUS>
<!--Optional:-->
<urn:token>samplesmartmsid</urn:token>
<!--Optional:-->
<urn:transaction_id>30384</urn:transaction_id>
</urn:GETMSGSTATUS>
</soapenv:Body>
</soapenv:Envelope>

XML Response
<senv:Envelope xmlns:tns="urn:netcast_web_service"
xmlns:senv="http://schemas.xmlsoap.org/soap/envelope/">
<senv:Body>
<tns:GETMSGSTATUSResponse>
<tns:GETMSGSTATUSResult>RETGMS02</tns:GETMSGSTATUSResult>
</tns:GETMSGSTATUSResponse>
</senv:Body>
</senv:Envelope>

Download and Request Logs


This function is used to download transaction logs.

Function
GETLOGS

Parameters
 Transaction date
 SmartMS ID

Log Formats
 SENDSMS - datetime|ip_address|SENDSMS|params|result
 SENDSMSOPT - datetime|ip_address|SENDSMS|params|result

SMART Messaging Suite | Web Service/API Guide 8


 GETMSGSTATUS – datetime|ip_address|GETMSGSTATUS|transaction_id|result
 GETINCOMING – datetime|ip_address|GETINCOMING|PARMSID|SMS : (total
count of how many subscriber reply/texted to 09088968278.)
 GETSMART - datetime|ip_address|GETSMART|PARMSID|SMS : (total count of
how many subscriber reply/texted to 391+Access Code.)
 GETCONNECT – datetime|ip_address|GETCONNECT|PARMSID|WELCOME
MSG
 GETLOGS – datetime|ip_address|GETLOGS|PARMSID|LOGS : (total count of
transaction logs)

Example
<?php
$URL = "https://ws.smartmessaging.com.ph/soap/?wsdl";
$client = new soapclient($URL);
$token = "samplesmartmsid";

$method = 'GETLOGS';
$parameters = array(
array(
'token' => $token
)
);
$return = $client->__call($method, $parameters);
?>

Return
Transaction logs (format: datetime|ip_address|function_call|parmsid|result)

XML Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:netcast_web_service">
<soapenv:Header/>
<soapenv:Body>
<urn:GETLOGS>
<!--Optional:-->
<urn:token>samplesmartmsid</urn:token>
<!--Optional:-->
<urn:transaction_date>20150120</urn:transaction_date>
</urn:GETLOGS>
</soapenv:Body>
</soapenv:Envelope>

SMART Messaging Suite | Web Service/API Guide 9


XML Response
<senv:Envelope xmlns:tns="urn:netcast_web_service"
xmlns:senv="http://schemas.xmlsoap.org/soap/envelope/">
<senv:Body>
<tns:GETLOGSResponse>
<tns:GETLOGSResult> 2015-01-20
14:19:31|***.***.***.***|GETLOGS|PARMSID|LOGS:8
2015-01-20 14:21:55|***.***.***.***|GETCONNECT|PARMSID|WELCOME MSG
2015-01-20 14:22:07|***.***.***.***|GETINCOMING|PARMSID|SMS: 0
2015-01-20 14:22:25|***.***.***.***|GETSMART|PARMSID|SMS: 0
2015-01-20 14:23:30|***.***.***.***|SENDSMS|TO: 639191234567|1426
2015-01-20 14:23:50|***.***.***.***|GETMSGSTATUS|1426|RETGMS02
2015-01-20 14:24:52|***.***.***.***|SENDSMSOPT|TO: 639191234567|1427
2015-01-20
14:25:07|***.***.***.***|GETMSGSTATUS|1427|RETGMS02</tns:GETLOGSResult>
</tns:GETLOGSResponse>
</senv:Body>
</senv:Envelope>

Note Once the logs have been pulled already, it will no longer be shown
when the methods are called again.

SMART Messaging Suite | Web Service/API Guide 10


Download Incoming Messages from Smart Subscribers
This function is used to fetch/retrieve all received messages from Smart subscribers.

Function
GETSMART

Parameters
SmartMS ID

Example
<?php
$URL = "https://ws.smartmessaging.com.ph/soap/?wsdl";
$client = new soapclient($URL);
$token = "samplesmartmsid";

$method = 'GETSMART';
$parameters = array(
array(
'token' => $token
)
);
$return = $client->__call($method, $parameters);
?>

Return
Array containing sender number and message: Array('timestamp'=>'
2015/01/20 13:50:46', 'min'=>'639191234567', 'msg'=>'Sample
reply msg.' )

XML Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:netcast_web_service">
<soapenv:Header/>
<soapenv:Body>
<urn:GETSMART>
<!--Optional:-->
<urn:token>samplesmartmsid</urn:token>
</urn:GETSMART>
</soapenv:Body>
</soapenv:Envelope>

SMART Messaging Suite | Web Service/API Guide 11


XML Response
<senv:Envelope xmlns:tns="urn:netcast_web_service" xmlns:s0="apps.core.utils"
xmlns:senv="http://schemas.xmlsoap.org/soap/envelope/">
<senv:Body>
<tns:GETSMARTResponse>
<tns:GETSMARTResult>
<s0:Transaction>
<s0:timestamp>2015/01/20 13:50:46</s0:timestamp>
<s0:min>639191234567</s0:min>
<s0:msg>Sample reply msg.</s0:msg>
</s0:Transaction>
</tns:GETSMARTResult>
</tns:GETSMARTResponse>
</senv:Body>
</senv:Envelope>

Download Incoming Messages


This function is used to fetch/retrieve all subscribers (Smart, Sun, Globe).

Function
GETINCOMING

Parameters
SmartMS ID

Example
<?php
$URL = "https://ws.smartmessaging.com.ph/soap/?wsdl";
$client = new soapclient($URL);
$token = "samplesmartmsid";

$method = 'GETINCOMING';
$parameters = array(
array(
'token' => $token
)
);
$return = $client->__call($method, $parameters);
?>

SMART Messaging Suite | Web Service/API Guide 12


Return
Array containing sender number and message: Array('timestamp'=>'
2015/01/20 13:50:46', 'min'=>'639191234567', 'msg'=>'Sample
reply msg.' )

XML Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:netcast_web_service">
<soapenv:Header/>
<soapenv:Body>
<urn:GETINCOMING>
<!--Optional:-->
<urn:token>samplesmartmsid</urn:token>
</urn:GETINCOMING>
</soapenv:Body>
</soapenv:Envelope>

XML Response
<senv:Envelope xmlns:tns="urn:netcast_web_service" xmlns:s0="apps.core.utils"
xmlns:senv="http://schemas.xmlsoap.org/soap/envelope/">
<senv:Body>
<tns:GETINCOMINGResponse>
<tns:GETINCOMINGResult>
<s0:Transaction>
<s0:timestamp>2015/01/20 13:50:46</s0:timestamp>
<s0:min>639191234567</s0:min>
<s0:msg>Sample reply msg.</s0:msg>
</s0:Transaction>
</tns:GETINCOMINGResult>
</tns:GETINCOMINGResponse>
</senv:Body>
</senv:Envelope>

SMART Messaging Suite | Web Service/API Guide 13


3 | Error Code Per Function

Function Parameter Return Error Codes


GETCONNECT SmartMS ID (string) Welcome Message RETEMP01
(string) RETVAL01
RETVAL02
SENDSMS Mobile Number Transaction RETEMP01
(int/string) Reference Number RETEMP02
Message (string) (int/string) RETEMP03
SmartMS ID (string) RETVAL01
RETVAL02
GETMSGSTATUS Transaction RETGMS01 RETEMP01
Reference Number RETGMS02 RETVAL01
(int/string) RETGMS03 RETVAL02
SmartMS ID (string) RETGMS04
GETLOGS Date (yyyymmdd) Transaction Logs RETEMP01
SmartMS ID (string) (string) RETEMP06
RETVAL01
RETVAL02
GETSMART SmartMS ID (string) Incoming RETEMP01
Messages RETVAL01
(array) RETVAL02
GETINCOMING SmartMS ID (string) Incoming RETEMP01
[Telco Type(int)] Messages RETVAL01
(array) RETVAL02

SMART Messaging Suite | Web Service/API Guide 14


4 | Error Code and Description

Error Code Description

RETEMP01 Netcast ID is empty


RETEMP02 Mobile Number is empty
RETEMP03 Message is empty
RETEMP05 Transaction Reference Number is empty
RETEMP06 Date is empty
RETGMS01 Pending/Queued
RETGMS02 SMS Sent
RETGMS03 SMS Sending Failed
RETGMS04 Invalid Transaction Reference Number
RETVAL01 Unauthorized IP address
RETVAL02 Unauthorized Netcast ID
RETVAL03 Invalid Mobile Number
RETVAL04 Unrecognized Mobile Number
RETVAL10 Excluded Mobile Number
RETVAL11 Invalid Date

SMART Messaging Suite | Web Service/API Guide 15


5 | SOAP Server and Functions

Server Endpoint
https://ws.smartmesssaging.com.ph/soap/

Full WSDL Documentation


https://ws.smartmesssaging.com.ph/soap/?wsdl

Generic Client Script


<?php
$nusoap_path = "<path_to_nusoap_directory>";
require_once("$nusoap_path/lib/nusoap.php");

$URL = "https://ws.smartmessaging.com.ph/soap/?wsdl";
$client = new soapclient($URL);
$token = " <WS TOKEN> ";

$method = '<function call here>';


$parameters = 'function parameters here';
$return = $client->__call($method, $parameters);

echo $return; //show return value; alternatives:


//var_dump($return) or print_r($return);

//Sample:
//$URL = "https://ws.smartmessaging.com.ph/soap/?wsdl";
//$client = new soapclient($URL);
//$token = "samplesmartmsid";

//$method = 'GETCONNECT';
//$parameters = array(
// array(
// 'token' => $token
// )
// );
//$return = $client->__call($method, $parameters);
?>

SMART Messaging Suite | Web Service/API Guide 16

S-ar putea să vă placă și