Examples And Concepts

From SMS Wiki
Revision as of 11:05, 15 August 2007 by Administrator (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

SOAP API Usage

Every function of the SOAP API that requires authentication must pass in Authentication Parameters, to acquire a set of Authentication Parameters, please use the API found at: http://api.upsidewireless.com/soap/Authentication.asmx

The two values that are returned from the function are then used for every subsequent calls to the API. The Token parameter will never change for the life of the account whereas the Signature will change if your password changes. In most applications, you will store these variables in a constant or configuration store.

Sending SMS

Sending an SMS can be handled by way of sending us an SMTP message or via HTTP/SOAP Interface.

Receiving SMS

The method of receiving Inbound SMS messages is by way of HTTP POST. A few variables are passed in the body of the POST.

  • name - Username to which SMS came (useful if you have multiple accounts with our service)
  • sender - Mobile phone number of the sender. The number is international format (US and Canada this means 11-digit number starting with "1")
  • data - Text of incoming SMS
  • carriercode - (shortcode accounts only) MCC/MNC identifying the sender's mobile network. You must store this with the number and pass it back when sending messages
  • inboundnumber - (for short/long code accounts only) Gateway number that received the message. This is useful if you have multiple dedicated numbers associated with your account

Examples

Example 1 - No short code

You can use the following HTML to emulate what our server will send your service.

http://myurl.com/myaction?sender=17789999999&data=hello&name=username

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<title>Received SMS Emulator (Via HTTP POST)</title>
	</head>
	<body>
		<form id="emulator" name="emulator" method="post" action="http://sms.yourdomain.com/incoming.php">
			<table>
				<tr>
					<td>Sender:</td>
					<td>
						<input name="sender" type="text" id="sender" value="17789999999"/>
					</td>
					<td>sender</td>
				</tr>
				<tr>
					<td>Message:</td>
					<td>
						<input name="data" type="text" id="data" value="Hello"/>
					</td>
					<td>data</td>
				</tr>
				<tr>
					<td>User Name:</td>
					<td>
						<input name="name" type="text" id="name" value="Account_Name"/>
					</td>
					<td>name</td>
				</tr>
				<tr>
					<td colspan="2" align="right">
						<input type="submit" name="Submit" value="Submit"/>
					</td>
					<td>&nbsp;</td>
				</tr>
			</table>
		</form>
	</body>
</html>


Example 2 - Short code

You can use the following HTML to emulate what our server will send your service. You will notice that in addition to the three standard variables, in this case carrier code as well as incoming gateway number are passed as parameters.

http://myurl.com/myaction?sender=17789999999&data=hello&name=username&inboundnumber=987333&carriercode=302370

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<title>Received SMS Emulator (Via HTTP POST)</title>
	</head>
	<body>
		<form id="emulator" name="emulator" method="post" action="http://sms.yourdomain.com/incoming.php">
			<table>
				<tr>
					<td>Sender:</td>
					<td>
						<input name="sender" type="text" id="sender" value="17789999999"/>
					</td>
					<td>sender</td>
				</tr>
				<tr>
					<td>Message:</td>
					<td>
						<input name="data" type="text" id="data" value="Hello"/>
					</td>
					<td>data</td>
				</tr>
				<tr>
					<td>User Name:</td>
					<td>
						<input name="name" type="text" id="name" value="Account_Name"/>
					</td>
					<td>name</td>
				</tr>
				<tr>
					<td>Inbound Number:</td>
					<td>
						<input name="inboundnumber" type="text" id="inboundnumber" value="987333"/>
					</td>
					<td>inboundnumber</td>
				</tr>
				<tr>
					<td>Carrier Code:</td>
					<td>
						<input name="carriercode" type="text" id="302370"/>
					</td>
					<td>carriercode</td>
				</tr>
				<tr>
					<td colspan="2" align="right">
						<input type="submit" name="Submit" value="Submit"/>
					</td>
					<td>&nbsp;</td>
				</tr>
			</table>
		</form>
	</body>
</html>