10.11.2013 Views

Sendega API documentation.pdf - GetACoder

Sendega API documentation.pdf - GetACoder

Sendega API documentation.pdf - GetACoder

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

FRA<br />

1


CONTENTS<br />

<strong>Sendega</strong> <strong>API</strong> <strong>documentation</strong> ................................................................................................................................... 4<br />

Introduction ........................................................................................................................................................ 4<br />

Overview ............................................................................................................................................................. 4<br />

Security ........................................................................................................................................................... 4<br />

Formats and standards ................................................................................................................................... 4<br />

Send SMS and MMS ................................................................................................................................................ 5<br />

Examples ............................................................................................................................................................. 6<br />

Return values ...................................................................................................................................................... 7<br />

Error codes .......................................................................................................................................................... 7<br />

Send WAP PUSH ...................................................................................................................................................... 8<br />

Example ............................................................................................................................................................... 8<br />

Error codes .......................................................................................................................................................... 8<br />

Receive SMS and MMS ............................................................................................................................................ 9<br />

Example ............................................................................................................................................................... 9<br />

Download mms content .................................................................................................................................... 10<br />

Error codes ........................................................................................................................................................ 10<br />

Delete queued messages ...................................................................................................................................... 11<br />

Error codes ........................................................................................................................................................ 11<br />

Delivery reports..................................................................................................................................................... 12<br />

DLR ‐ Post .......................................................................................................................................................... 12<br />

DLR ‐ Request .................................................................................................................................................... 12<br />

Error codes ........................................................................................................................................................ 13<br />

Network query / HLR Lookup ................................................................................................................................ 14<br />

New query ......................................................................................................................................................... 14<br />

Error codes ........................................................................................................................................................ 15<br />

Recieve results .................................................................................................................................................. 15<br />

Prefix search (Code word) ..................................................................................................................................... 15<br />

Error codes ........................................................................................................................................................ 16<br />

2


Create prefix (codeword) ...................................................................................................................................... 16<br />

Error codes ........................................................................................................................................................ 17<br />

Create subprefix .................................................................................................................................................... 17<br />

Error codes ........................................................................................................................................................ 18<br />

List prefix data ....................................................................................................................................................... 18<br />

Error codes ........................................................................................................................................................ 19<br />

Manage prefix rules .............................................................................................................................................. 19<br />

Error codes ........................................................................................................................................................ 21<br />

Manage contacts ................................................................................................................................................... 22<br />

Get updated currency values ................................................................................................................................ 23<br />

Premium SMS tariff classes ................................................................................................................................... 24<br />

Norway, short code 2440 .................................................................................................................................. 24<br />

Code examples ...................................................................................................................................................... 26<br />

Send SMS........................................................................................................................................................... 26<br />

ASP – VBScript ............................................................................................................................................... 26<br />

ASP.NET – C# ................................................................................................................................................. 26<br />

ASP.NET – VB ................................................................................................................................................. 27<br />

PHP 4 ............................................................................................................................................................. 27<br />

PHP 5 ............................................................................................................................................................. 28<br />

Send MMS ......................................................................................................................................................... 28<br />

Useful links .................................................................................................................................................... 28<br />

Receive SMS and MMS ...................................................................................................................................... 29<br />

ASP – VBSCRIPT ............................................................................................................................................. 29<br />

PHP ................................................................................................................................................................ 29<br />

How to store Base64 data as Image type in Microsoft SQL Server ................................................................... 30<br />

Function: Base64toBin .................................................................................................................................. 30<br />

Base64 to Binary procedure .......................................................................................................................... 31<br />

3


SENDEGA <strong>API</strong> DOCUMENTATION<br />

<strong>API</strong> last updated 28.7.2008<br />

INTRODUCTION<br />

Neovada Telecom AS and its product <strong>Sendega</strong>.com is a solution and technology for micro payments and<br />

communication using SMS, MMS and WAP messaging. Neovada Telecom AS act as a transparent, white‐label<br />

Content Acquirer and Transaction Router between Operators and Content Providers. Content Providers are<br />

provided with an easily implemented interface to connect to <strong>Sendega</strong>.com, which handles integration to the<br />

Operators.<br />

This document provides a description of how to integrate the Content Provider’s services for sending and<br />

receiving SMS, MMS and WAP messages trough the <strong>Sendega</strong>.com system. The document is intended for<br />

technical architects and designers of the Content Provider’s services.<br />

OVERVIEW<br />

<strong>Sendega</strong> <strong>API</strong> consists of a set of methods for sending and receiving SMS, MMS and WAP messages. All<br />

responses in HTTP are answered with XML. Customer ID (CID) and password must always be used when using<br />

the methods.<br />

SECURITY<br />

All IP addresses for servers that will communicate via the <strong>API</strong> should be registered with us to prevent<br />

unauthorised persons sending SMS messages from your account. IP addresses can be registered on our<br />

customer pages at <strong>Sendega</strong>.com<br />

FORMATS AND STANDARDS<br />

All values are sent/received must be as described in this document. The date format is ISO‐8601. YYYY‐MM‐DD<br />

HH:MM Return values comply with xml version 1.0 and use ISO‐8859‐1 encoding. All return xml are guaranteed<br />

“well formed”, and follow the template settings in this <strong>API</strong> for each individual method.<br />

Enquiries to <strong>Sendega</strong>.com system can either be POST or GET. We recommend POST for methods where a long<br />

message, or many telephone numbers, etc, are sent, as GET has a limitation in the length of the address string.<br />

All communication takes place via HTTP POST/GET. We support both standard http, and https for encrypted<br />

connection.<br />

http://api.sendega.com<br />

https://api.sendega.com<br />

4


SEND SMS AND MMS<br />

Parameter Type Default M/O* Max Description<br />

value<br />

length<br />

CID Integer ‐ M 5 Customer ID for identification<br />

Password String ‐ M 20 Customer password for identification<br />

Recipient String ‐ M 8000 The MSISDN that the message should be<br />

sent to, starting with country code:<br />

Example 479232592.<br />

Multiple recipients are comma separated<br />

GroupID Integer ‐ O 5 GroupID for use of local contact groups<br />

stored at <strong>Sendega</strong>.com<br />

FromNumber Integer If omitted,<br />

this value is<br />

O 16 The originating MSISDN or short number<br />

address for the outgoing message.<br />

set by<br />

<strong>Sendega</strong>.<br />

FromAlpha String ‐ O 11 The originating alpha numeric address for<br />

the outgoing message. Behavior may vary<br />

with Operator integrations<br />

Header String O 280 Message header. Must be hex‐encoded.<br />

Only used when sending binary messages.<br />

Msg‐parameter must contain the message<br />

content hex‐encoded.<br />

Msg String ‐ M 640 The message content. The system<br />

automatically splits the message up into<br />

more messages if the text length exceeds<br />

160 characters. Message will automatically<br />

be displayed as one single long message at<br />

the receiver, if the receiver’s phone<br />

supports it.<br />

MMSData String ‐ O ‐ The MMS file is delivered as Base 64<br />

encoded string. Example<br />

MMSData=UESDBBQACAAIAAYS<br />

Pricegroup Integer 0 O 5 Tariff class for sending premium messaging<br />

(premium rate). Valid tariff classes is<br />

documented in own chapter. See note<br />

below ¹<br />

Operator Integer 0 O 4 Must be included when sending premium<br />

messages.<br />

See note below ²<br />

Sendtime String Immediately O 25 The message can be delivered with delayed<br />

delivery time.<br />

Format: YYYY‐MM‐DD HH:MM:SS<br />

Flash Integer 0 O 1 Sends the message directly to the<br />

recipients display. Behavior may vary with<br />

Operator integrations and recipients<br />

equipment.<br />

ReferenceID String ‐ O 50 Only to be used when sending premium<br />

SMS to UK and NL³<br />

CustomerMsgID Integer ‐ O 19 Your local msgid reference.<br />

* M = Mandatory, O = Optional<br />

5


¹ When sending premium messages, the fromNumber parameter must be the short code available for the<br />

preferred country. Ex fromNumber=2440 for Norway. Please see tariff classes in own chapter for available<br />

short codes.<br />

² Operator is only used when sending premium messages. If operator is omitted the system will perform a<br />

network query. Price 0.10 NOK<br />

³ ReferenceID is only to be used for subscription services where registration is done on web etc. First premium<br />

SMS must be “referenceid=26;STARTWEB” for Netherland. and referenceid=27;STARTWEB for UK customers.<br />

Message is sent to operator, and the user is registered to your service. If message is successful, then all<br />

messages are to be sent with referenceid=26;WARN for Netherland and referenceID=27;WARN for UK. This<br />

message will be delivered, and end user is charged.<br />

EXAMPLES<br />

EXAMPLE – SEND SMS<br />

http://api.sendega.com/sendSMS.asp<br />

?cid=xxx<br />

&password=xxxx<br />

&recipient=4796554583<br />

&fromAlpha=<strong>Sendega</strong>.com<br />

&msg=Hello world!<br />

EXAMPLE – SEND BINARY SMS<br />

http://api.sendega.com/sendSMS.asp<br />

?cid=xxx<br />

&password=xxxx<br />

&recipient=4796554583<br />

&fromAlpha=<strong>Sendega</strong>.com<br />

&header=0B05040B84C0020003100301<br />

&msg=6C497900436F6E746163747300746578742F782D76636172640043616C656E6 [..]<br />

EXAMPLE – SEND MMS<br />

http://api.sendega.com/sendSMS.asp<br />

?cid=xxx<br />

&password=xxxx<br />

&recipient=4796554583<br />

&fromAlpha=<strong>Sendega</strong>.com<br />

&msg=Hello world!<br />

&mmsdata= /9j/4AAQSkZJRgABAQEASABIAAD/7QAcUGhvd […]<br />

6


RETURN VALUES<br />

RETURNVALUES WHEN MESSAGE IS SENT SUCCESSFULLY<br />

<br />

<br />

true<br />

41541<br />

<br />

RETURNVALUE WHEN MESSAGE FAILED.<br />

<br />

<br />

false<br />

xxxxx<br />

10xx<br />

<br />

ERROR CODES<br />

Error no<br />

Error description<br />

1001 Wrong CID<br />

1002 Password not specified<br />

1003 Message not specified<br />

1004 Recipient or groupid not specified<br />

1005 Fromalpha value is barred<br />

1006 Wrong date and time format<br />

1007 CID and password does not match, or no access<br />

1008 Message to long<br />

1009 Server IP: xxx.xxx.xxx.xxx have no access to this account.<br />

1010 Your demo account is empty. Please contact customer service<br />

1011 Your account is not upgraded for use of premium SMS.<br />

1012 Recipient not a valid MSISDN<br />

1013 GroupID contains non‐numeric characters. Use one groupID only.<br />

1014 Local referenceID (customerID) must be a numeric value.<br />

1015 Sendervalue missing. Use fromAlpha or fromNumber parameter.<br />

1016 Not a valid pricegroup<br />

1017 FromAlpha value to long. Maximum 11 characters.<br />

1018 Internal error – Contact customer service<br />

1019 Internal error – Contact customer service<br />

1020 Correct short code must be specified as fromNumber when sending premium sms<br />

7


SEND WAP PUSH<br />

Wap push is sent as an ordinary SMS with clear text. The message to be sent must use the following syntax:<br />

wappush:wap.vg.no;|;Norwegian newspaper<br />

EXAMPLE<br />

http://api.sendega.com/sendSMS.asp<br />

?cid=xxx<br />

&password=xxxx<br />

&recipient=4796554583<br />

&fromAlpha=<strong>Sendega</strong>.com<br />

&msg= wappush:wap.vg.no;|;Norwegian newspaper<br />

ERROR CODES<br />

Error no<br />

Error description<br />

1001 Wrong CID<br />

1002 Password not specified<br />

1003 Message not specified<br />

1004 Recipient or groupid not specified<br />

1005 Fromalpha value is barred<br />

1006 Wrong date and time format<br />

1007 CID and password does not match, or no access<br />

1008 Message to long<br />

1009 Server IP: xxx.xxx.xxx.xxx have no access to this account.<br />

1010 Your demo account is empty. Please contact customer service<br />

1011 Your account is not upgraded for use of premium SMS.<br />

1012 Recipient not a valid MSISDN<br />

1013 GroupID contains non‐numeric characters. Use one groupID only.<br />

1014 Local referenceID (customerID) must be a numeric value.<br />

1015 Sendervalue missing. Use fromAlpha or fromNumber parameter.<br />

1016 Not a valid pricegroup<br />

1017 FromAlpha value to long. Maximum 11 characters.<br />

1018 Internal error – Contact customer service<br />

1019 Internal error – Contact customer service<br />

1020 Correct short code must be specified as fromNumber when sending premium sms<br />

8


RECEIVE SMS AND MMS<br />

To be able to receive messages you must order a code word (prefix) from <strong>Sendega</strong> customer pages. It may take<br />

up to 2 hours from the code word is registered until it can be used. By default, all messages received is only<br />

stored at <strong>Sendega</strong>.com. You can add several rules to a code word, like automatic response and forwarding to<br />

external URL address using HTTP GET method as described here.<br />

IMPORTANT:<br />

The URL that receives the message must return the text OK only, if the forward is to be regarded as<br />

successful.<br />

Parameter Type Default value M/O* Max length Description<br />

msgid Integer ‐ M 10 Unique message ID<br />

tel Integer ‐ M 16 The Consumer’s MSISDN, starting<br />

with the country code (Sender of the<br />

text). Example 4795956584.<br />

msg String ‐ M 640 Message content as sent from<br />

Consumer.<br />

If MMS message, this parameter wil<br />

contain the message subject.<br />

prefixID Integer M 10 Each codeword has its unique ID at<br />

<strong>Sendega</strong>. If subcodeword is used,<br />

the subcodeword’s id is returned.<br />

prefix String ‐ M 30 Codeword.<br />

operator Integer ‐ M 5 The ID of the Consumer’s Mobile<br />

Operator. A list of available<br />

operators is provided by <strong>Sendega</strong><br />

upon request.<br />

shortCode Integer ‐ M 11 The short number the message was<br />

sent to. Example: 2440<br />

isMMS Integer 0 M 1 If MMS, value is 1<br />

mmsFile String ‐ O 500 Name of the zipfile to be<br />

downloaded from our webserver.<br />

mmmsData String ‐ O MMSdata as Base64 encoded string.<br />

* M = Mandatory, O = Optional<br />

EXAMPLE<br />

EXAMPLE – INCOMING SMS FORWARDING<br />

http://www.mywebserver.com/sms_in.asp<br />

?msgid=423423<br />

&tel=4799xxxxxx<br />

&msg=PREFIX my message<br />

&prefixID=xx<br />

&prefix=PREFIX<br />

&operator=230<br />

&shortCode=2440<br />

9


EXAMPLE ‐ INCOMING MMS FORWARDING<br />

http://www.mywebserver.com/sms_in.asp<br />

?msgid=423423<br />

&tel=4799xxxxxx<br />

&msg=PREFIX my message<br />

&prefixid=xx<br />

&prefix=PREFIX<br />

&operator=230<br />

&shortcode=2440<br />

&isMMS=1<br />

&mmsFile=mms2008/1302_423421.zip<br />

&mmsData= /9j/4AAQSkZJRgABAQEASABIAAD/7QAcUGhvd […]<br />

* Please see customer pages and url‐forward settings for your prefix to receive mmsdata.<br />

DOWNLOAD MMS CONTENT<br />

MMS files are stored on our <strong>API</strong> server for easy download. Use this method to download the zip‐file<br />

Parameter Type Default value M/O* Max length Description<br />

CID Integer ‐ M 5 Customer ID for identification<br />

Password String ‐ M 20 Customer password for<br />

identification<br />

mmsFile String ‐ M 50 Name of the zipfile to download.<br />

EXAMPLE<br />

http://www.mywebserver.com/getmms.asp<br />

?cid=xxxx<br />

&passwordl=xxxxxx<br />

&mmsfile=mms_2008\1302_423421.zip<br />

ERROR CODES<br />

Error no<br />

Error description<br />

9001 Wrong CID<br />

9002 Password not specified<br />

9003 MMS file not specified<br />

9004 CID and password does not match, or no access<br />

9005 File not found or does not exists<br />

9006 Internal error – Contact customer service<br />

10


DELETE QUEUED MESSAGES<br />

Messages sent using the sendtime parameter is queued on our servers and sent to enduser at given time.<br />

These messages can be deleted using this method.<br />

Parameter Type Default value M/O* Max length Description<br />

CID Integer ‐ M 5 Customer ID for identification<br />

Password String ‐ M 20 Customer password for<br />

identification<br />

msgid Integer ‐ M 10 MessageID<br />

EXAMPLE<br />

http://api.sendega.com/deleteQuedSMS.asp<br />

?cid=xxxx<br />

&password=xxxxxx<br />

&msgid=18254541<br />

ERROR CODES<br />

Error no<br />

Error description<br />

10001 Wrong CID<br />

10002 Password not specified<br />

10003 CID and password does not match, or no access<br />

10004 Msgid not specified<br />

10005 No queued message found<br />

10006 Internal error – Contact customer service<br />

11


DELIVERY REPORTS<br />

All messages are delivered with status codes from the various telecom operators. Delivery reports can be either posted<br />

automatically to an external URL, or requested.<br />

DLR ‐ POST<br />

The following parameters will be POSTED to an external URL. This URL must be added on our customer pages.<br />

Parameter Type Default value M/O* Max length Description<br />

msgid Integer ‐ M 5 Unique messageid<br />

recipient Integer M 16 Recipients MSISDN<br />

statusid Integer M 2 4=Delivered, 5=Not delivered<br />

registered String M 25 When message was registered at<br />

<strong>Sendega</strong>.com Format: YYYY‐MM‐DD<br />

HH:MM:SS.MII<br />

sentdate String M 25 When message was sent to operator<br />

Format: YYYY‐MM‐DD<br />

HH:MM:SS.MII<br />

statusUpdated String M 25 When message was updated with<br />

DLR from operator. Format: YYYY‐<br />

MM‐DD HH:MM:SS.MII<br />

revenue String M 10 Payout or cost value in NOK<br />

errorcode String M 250 Short errorcode from operator<br />

errordescription String M 1000 Long errodescription if error.<br />

mcc Integer M 5<br />

Mobile country code.<br />

mnc Integer M 5<br />

Mobile network code. (Operator)<br />

network String M 50 Mobile network name<br />

countrycode String M 5 Countrycode. Ex. Norway=47<br />

customermsgid Integer M<br />

* M = Mandatory, O = Optional<br />

All mcc and mnc codes are available as CSV documents at http://www.sendega.com<br />

DLR ‐ REQUEST<br />

Parameter Type Default value M/O* Max length Description<br />

CID Integer ‐ M 5 Customer ID for identification<br />

Password String ‐ M 20 Customer password for<br />

identification<br />

Msgid String ‐ M ‐ The unique <strong>Sendega</strong> msgid returned<br />

when sending message. Multiple<br />

msgid’s must be comma separated.<br />

Reporttype String XML O 3 Delivery reports can be returned as<br />

CSV or XML.<br />

* M = Mandatory, O = Optional<br />

12


EXAMPLE<br />

http://api.sendega.com/getSmsStatus.asp<br />

?cid=xxx<br />

&password=xxxx<br />

&msgid=9023027<br />

&reporttype=xml<br />

RETURN VALUE<br />

Return value when using report type=xml<br />

<br />

<br />

true<br />

1<br />

<br />

9023027<br />

0<br />

479xxxxxxx<br />

4<br />

0<br />

<br />

DELIVERED<br />

<br />

2008-05-11 12:32<br />

0<br />

<br />

2440<br />

2008-05-11 12:33<br />

1<br />

Norway<br />

-0,39<br />

<br />

<br />

ERROR CODES<br />

Error no<br />

Error description<br />

6001 Wrong CID<br />

6002 Password not specified<br />

6003 Msgid not specified<br />

6004 CID and password does not match or no access<br />

6005 Server IP: xxx.xxx.xxx.xxx have no access to this account.<br />

6006 No SMS found<br />

6007 Internal error – Contact customer service<br />

6008 Internal error – Contact customer service<br />

STATUS CODES<br />

Error no<br />

Error description<br />

1 Message received OK to <strong>Sendega</strong> db<br />

2 Processing message<br />

3 Delivered operator. Waiting for delivery report.<br />

4 Message delivered to end user<br />

5 Message failed. See errordescription field for more details<br />

13


8 Temporary queued.<br />

13 Queued for HLR<br />

14 Processing HLR query<br />

15 Waiting for HLR report<br />

NETWORK QUERY / HLR LOOKUP<br />

HLR lookup is used to check which country and operator the mobile phone number belongs to, as well as which<br />

country the mobile subscriber is located in. You post a new query and receive a hlr‐id to track the query.<br />

Results are posted back to an URL located on your server. This URL must be specified on our customer pages at<br />

http://www.sendega.com<br />

NEW QUERY<br />

Parameter Type Default value M/O* Max length Description<br />

CID Integer ‐ M 5 Customer ID for identification<br />

Password String ‐ M 20 Customer password for<br />

identification<br />

Msisdn Integer ‐ M 16 The Consumer’s MSISDN.<br />

postBackURL String ‐ O 1000 Postback URL to post query results.<br />

* M = Mandatory, O = Optional<br />

EXAMPLE<br />

http://api.sendega.com/hlr.asp<br />

?cid=xxx<br />

&password=xxxx<br />

&msisdn=4479xxxxxx<br />

&postbackurl=http://www.mydomain.com/hrlResults.asp<br />

RETURNVALUES WHEN MESSAGE IS SENT SUCCESSFULLY<br />

<br />

<br />

true<br />

41541<br />

<br />

RETURNVALUE WHEN MESSAGE FAILED.<br />

<br />

<br />

false<br />

xxxxx<br />

70xx<br />

<br />

14


ERROR CODES<br />

Error no<br />

Error description<br />

7001 Wrong CID<br />

7002 Password not specified<br />

7003 Not a valid msisdn<br />

7004 CID and password does not match or no access<br />

7005 Server IP: xxxx have no access to this account.<br />

7006 Your account is not upgraded for use of HLR<br />

7007 PostbackURL not specified, or no URL saved in your account.<br />

RECIEVE RESULTS<br />

The following parameters will be POSTED to an external URL. This URL must be added on our customer pages or provided<br />

using the postbackurl parameter.<br />

Parameter Type Default value M/O* Max length Description<br />

Msgid Integer ‐ M 9 Unique queryid<br />

Msisdn Integer ‐ M 16 Msisdn<br />

Mcc Integer ‐ M 3 Mobile country code<br />

Mnc Integer ‐ M 3 Mobile network code<br />

Network String ‐ M 500 Network name<br />

formerNetworkName String ‐ M 500 Former network name<br />

Country String ‐ M 500 Country<br />

* M = Mandatory, O = Optional<br />

ALL<br />

PREFIX SEARCH (CODE WORD)<br />

To receive messages a code word must be ordered at <strong>Sendega</strong> customer pages. This method allows you to do a<br />

search for available code words at <strong>Sendega</strong>’s short codes. Available short codes can be found on <strong>Sendega</strong><br />

customer pages.<br />

Parameter Type Default value M/O* Max length Description<br />

CID Integer ‐ M 5 Customer ID for identification<br />

Password String ‐ M 20 Customer password for<br />

identification<br />

Prefix String ‐ M 30 Code word or prefix to search for.<br />

Shortcode Integer ‐ M 16 Short code. Example 2440<br />

* M = Mandatory, O = Optional<br />

EXAMPLE<br />

http://api.sendega.com/checkPrefix.asp<br />

?cid=xxx<br />

&password=xxxx<br />

&prefix=MYPREFIX<br />

&shortcode=2440<br />

15


RETURN VALUE<br />

Return value when code word is available.<br />

<br />

<br />

true<br />

<br />

Return value when code word is taken.<br />

<br />

<br />

false<br />

Prefix not available<br />

2009<br />

<br />

ERROR CODES<br />

Error no<br />

Error description<br />

2001 Wrong CID<br />

2002 Password not specified<br />

2003 Prefix not specified<br />

2004 Prefix must be between 3 and 12 characters<br />

2005 Short code not specified<br />

2006 CID and password does not match or no access<br />

2007 Server IP: xxx.xxx.xxx.xxx have no access to this account.<br />

2008 Not a valid short code<br />

2009 Prefix not available<br />

CREATE PREFIX (CODEWORD)<br />

Use this method to create new codeword. When created, each codeword is reserved for one year. Please see<br />

our webpage for current codeword prices.<br />

Parameter Type Default value M/O* Max length Description<br />

CID Integer ‐ M 5 Customer ID for identification<br />

Password String ‐ M 20 Customer password for<br />

identification<br />

Prefix String ‐ M 30 Prefix to create.<br />

Shortcode Integer ‐ M 16 Short code. Example 2440<br />

* M = Mandatory, O = Optional<br />

EXAMPLE<br />

http://api.sendega.com/createPrefix.asp<br />

?cid=xxx<br />

&password=xxxx<br />

&prefix=MYPREFIX<br />

&shortcode=2440<br />

RETURN VALUE<br />

Return value when code word is available.<br />

16


<br />

true<br />

<br />

Return value when code word is taken.<br />

<br />

<br />

false<br />

3007<br />

Prefix not available<br />

<br />

ERROR CODES<br />

Error no<br />

Error description<br />

3001 Wrong CID<br />

3002 Password not specified<br />

3003 Prefix not specified<br />

3004 Prefix must be between 3 and 12 characters<br />

3005 Short code not specified<br />

3006 CID and password does not match or no access<br />

3007 Prefix not available<br />

3008 Server IP: xxx.xxx.xxx.xxx have no access to this account.<br />

3009 Demo accounts not allowed to create prefix<br />

3010 Not a valid short code<br />

3011 Not able to create prefix<br />

CREATE SUBPREFIX<br />

Use this method to create new subprefixes.<br />

Parameter Type Default value M/O* Max length Description<br />

CID Integer ‐ M 5 Customer ID for identification<br />

Password String ‐ M 20 Customer password for<br />

identification<br />

PrefixID Integer ‐ M 5 PrefixID<br />

Subprefix String M 20 Name of the new subprefix<br />

* M = Mandatory, O = Optional<br />

EXAMPLE<br />

http://api.sendega.com/createSubPrefix.asp<br />

?cid=xxx<br />

&password=xxxx<br />

&prefixID=950<br />

&subprefix=NewSubprefix<br />

RETURN VALUE<br />

17


Return value when subprefix is created.<br />

<br />

<br />

true<br />

<br />

Return values when failed.<br />

<br />

<br />

false<br />

13002<br />

Password not specified<br />

<br />

ERROR CODES<br />

Error no<br />

Error description<br />

13001 Wrong CID<br />

13002 Password not specified<br />

13003 PrefixID not specified or not correct.<br />

13004 Subprefix not specified<br />

13005 CID and password does not match or no access<br />

13006 Server IP: xxxx have no access to this account.<br />

13007 Demo accounts not allowed to update subprefixdata<br />

13008 Internal error<br />

LIST PREFIX DATA<br />

Parameter Type Default value M/O* Max length Description<br />

CID Integer ‐ M 5 Customer ID for identification<br />

Password String ‐ M 20 Customer password for<br />

identification<br />

PrefixID Integer ‐ O 5 Unique prefixid. When left out,<br />

prefixdata for all prefixes will be<br />

listed.<br />

EXAMPLE<br />

http://api.sendega.com/getPrefixData.asp<br />

?cid=xxx<br />

&password=xxxx<br />

RETURN WHEN OK<br />

<br />

true<br />

<br />

131<br />

18


false<br />

DEMO<br />

2440<br />

True<br />

Hi. This is your reciept!<br />

0<br />

<strong>Sendega</strong><br />

False<br />

False<br />

http://www.mydomain.com/recieveIncomingMsg.asp<br />

False<br />

False<br />

<br />

False<br />

<br />

False<br />

<br />

False<br />

False<br />

<br />

False<br />

<br />

<br />

RETURN WHEN FAILED<br />

<br />

<br />

false<br />

11001<br />

Wrong CID<br />

<br />

ERROR CODES<br />

Error no<br />

Error description<br />

11001 Wrong CID<br />

11002 Password not specified<br />

11003 CID and password does not match or no access<br />

11004 Server IP: xxxx have no access to this account.<br />

11005 Internal error<br />

MANAGE PREFIX RULES<br />

Each prefix can have a set of rules handling the incoming messages.<br />

Parameter Type Default value M/O* Max length Description<br />

CID Integer ‐ M 5 Customer ID for identification<br />

Password String ‐ M 20 Customer password for<br />

identification<br />

PrefixID Integer ‐ M 5 Prefix ID for prefix to update.<br />

ReplyMsgActivated Bit ‐ O 1 0=Disabled, 1=Enabled<br />

ReplyMsg String ‐ M 160 Message sent back to sender<br />

ReplyPrice Integer 0 OIE 5 Tariff class for sending premium<br />

messaging (premium rate). Valid<br />

tariff classes is documented in own<br />

19


chapter<br />

ReplySender String ‐ OIE 16 Can be either a valid msisdn (max<br />

length=16) or alphanumeric (max<br />

length=11).<br />

ReplyFlash Bit 0 OIE 1 Sends the message directly to the<br />

recipients display. Behavior may<br />

vary with Operator integrations and<br />

recipients equipment.<br />

FwUrlActivated Bit ‐ O 1 0=Disabled, 1=Enabled<br />

FwUrl String ‐ OIE 1000 Full URL (http://yourdomain.com/)<br />

FwUrlBase64 Bit ‐ OIE 1 If enabled, the mmsdata will be<br />

posted as base64 encoded string.<br />

FwEmailActivated Bit ‐ O 1 0=Disabled, 1=Enabled<br />

FwEmail String ‐ OIE Valid email address.<br />

FwMobileActivated Bit ‐ O 1 0=Disabled, 1=Enabled<br />

FwMobile Integer ‐ OIE 16 Valid MSISDN.<br />

FwGroupActivated Bit ‐ O 1 0=Disabled, 1=Enabled<br />

FwGroupSender String ‐ OIE 16 Can be either a valid msisdn (max<br />

length=16) or alphanumeric (max<br />

length=11).<br />

FwGroupPrice Integer 0 OIE 5 Tariff class for sending premium<br />

messaging (premium rate). Valid<br />

tariff classes is documented in own<br />

chapter<br />

FwGroupID Integer ‐ OIE 5 Valid goupID to forward incoming<br />

message.<br />

AddToContacts Bit ‐ O 1 Add sender to contactlist<br />

AddToGroup Bit ‐ O 1 0=Disabled, 1=Enabled<br />

AddToGroupID Integer ‐ OIE 5 Valid groupID<br />

RemoveFromGroup Bit ‐ O 1 0=Disabled, 1=Enabled<br />

* M = Mandatory, O = Optional, OIE = Only if rule enabled<br />

EXAMPLE – ACTIVATE FORWARDING TO URL<br />

http://api.sendega.com/updatePrefixRules.asp<br />

?cid=xxx<br />

&password=xxxx<br />

&fwUrlActivated=1<br />

&fwUrl=http://www.mywebserver.com/incoming.asp<br />

&fwUrlBase64=0<br />

EXAMPLE – ACTIVATE AUTOMATIC RESPONSE<br />

http://api.sendega.com/updatePrefixRules.asp<br />

?cid=xxx<br />

&password=xxxx<br />

&replyMsgActivated=1<br />

&replyMsg=Thank you for your order.<br />

&replyPrice=5000<br />

&replySender=2440<br />

&replyFlash=0<br />

20


EXAMPLE – ACTIVATE AUTOMATIC RESPONSE AND ADD TO CONTACT LIST<br />

http://api.sendega.com/updatePrefixRules.asp<br />

?cid=xxx<br />

&password=xxxx<br />

&replyMsgActivated=1<br />

&replyMsg=Thank you for your order.<br />

&replyPrice=5000<br />

&replySender=2440<br />

&replyFlash=0<br />

&addToContacts=1<br />

RETURN VALUES<br />

Return value when rules are updated successfully.<br />

<br />

<br />

true<br />

<br />

Returnvalues when failed.<br />

<br />

<br />

false<br />

12010<br />

URL must be specified<br />

<br />

ERROR CODES<br />

Error no<br />

Error description<br />

12001 Wrong CID<br />

12002 Password not specified<br />

12003 PrefixID not specified, or not correct.<br />

12004 CID and password does not math or no access.<br />

12005 Server IP: xxxx have no access to this account.<br />

12006 Demo accounts not allowed to update prefixrules<br />

12007 Not rules were set to be updated<br />

12008 Replymsg not specified<br />

12009 Reply sender not specified<br />

12010 URL must be specified<br />

12011 Email not specified or invalid<br />

12012 Not a valid msisdn<br />

12013 Not a valid groupid<br />

12014 Groupid not specified<br />

12015 Not a valid pricegroup<br />

21


MANAGE CONTACTS<br />

As customer you have access to send messages directly from our customer pages. This method give you access<br />

to manage your contacts.<br />

Parameter Type Default value M/O* Max length Description<br />

CID Integer ‐ M 5 Customer ID for identification<br />

Password String ‐ M 20 Customer password for<br />

identification<br />

Countrycode Integer ‐ M 5 Country code. Norway 47<br />

Tel Integer ‐ M 16 Mobile number (msisdn)<br />

Firstname String ‐ O 50 Users firstname<br />

Lastname String ‐ O 100 Users lastname<br />

Delete Bit ‐ O 1 Add this parameter to delete contact<br />

Lookup Bit ‐ O 1 Not implemented.<br />

Will be used to retrieve msisdn<br />

owner information like firstname<br />

etc.<br />

* M = Mandatory, O = Optional<br />

EXAMPLE<br />

http://api.sendega.com/updateContact.asp<br />

?cid=xxx<br />

&password=xxxx<br />

&countrycode=47<br />

&tel=4794xxxxxx<br />

&firstname=John<br />

&lastname=Doe<br />

RETURN VALUE<br />

Return value when code word is available. When a new contact is added to your contact list, the parameter<br />

newcontact=1. If the given mobile number already exists the system performs an update and the paramtere<br />

newcontact=0.<br />

<br />

<br />

true<br />

1<br />

<br />

The following return value is given when a contact is deleted.<br />

<br />

<br />

true<br />

1<br />

<br />

22


GET UPDATED CURRENCY VALUES<br />

Our system is updated three times each day with current currency rates. Rates are provided from DNB Nor ASA<br />

Parameter Type Default value M/O* Max length Description<br />

CID Integer ‐ M 5 Customer ID for identification<br />

Password String ‐ M 20 Customer password for<br />

identification<br />

* M = Mandatory, O = Optional<br />

EXAMPLE<br />

http://api.sendega.com/getCurrency.asp<br />

?cid=xxx<br />

&password=xxxx<br />

RETURN VALUE<br />

<br />

<br />

true<br />

16.10.2007 15:10:00<br />

<br />

Norway


PREMIUM SMS TARIFF CLASSES<br />

We provide SMS billing (premium SMS) to several countries. Please upgrade your <strong>Sendega</strong> account to use<br />

premium SMS for the preferred short code and country. Please see <strong>Sendega</strong>.com for an updated out payment<br />

list.<br />

NORWAY, SHORT CODE 2440<br />

End user price is in NOK<br />

Price group, tariff<br />

End user price (inc vat)<br />

100 1,00 kr<br />

200 2,00 kr<br />

300 3,00 kr<br />

400 4,00 kr<br />

500 5,00 kr<br />

600 6,00 kr<br />

700 7,00 kr<br />

800 8,00 kr<br />

900 9,00 kr<br />

1000 10,00 kr<br />

1100 11,00 kr<br />

1200 12,00 kr<br />

1300 13,00 kr<br />

1400 14,00 kr<br />

1500 15,00 kr<br />

1600 16,00 kr<br />

1700 17,00 kr<br />

1800 18,00 kr<br />

1900 19,00 kr<br />

2000 20,00 kr<br />

2100 21,00 kr<br />

2200 22,00 kr<br />

2300 23,00 kr<br />

2400 24,00 kr<br />

2500 25,00 kr<br />

2600 26,00 kr<br />

2700 27,00 kr<br />

2800 28,00 kr<br />

2900 29,00 kr<br />

3000 30,00 kr<br />

3500 35,00 kr<br />

3900 39,00 kr<br />

4000 40,00 kr<br />

4500 45,00 kr<br />

4900 49,00 kr<br />

5000 50,00 kr<br />

5500 55,00 kr<br />

5900 59,00 kr<br />

6000 60,00 kr<br />

6500 65,00 kr<br />

6900 69,00 kr<br />

24


7000 70,00 kr<br />

7500 75,00 kr<br />

7900 79,00 kr<br />

8000 80,00 kr<br />

8500 85,00 kr<br />

8900 89,00 kr<br />

9000 90,00 kr<br />

9500 95,00 kr<br />

9900 99,00 kr<br />

10000 100,00 kr<br />

25


CODE EXAMPLES<br />

SEND SMS<br />

ASP – VBSCRIPT<br />

Download sendega_sms_library.asp: http://www.sendega.com/documents/sendega_sms_asp_library.txt<br />

<br />

<br />

<br />

ASP.NET – C#<br />

Download smsClass.cs: http://www.sendega.com/documents/sendega_sms_cnet_library.txt<br />

private void SmsFunc()<br />

{<br />

string sender = "<strong>Sendega</strong>";<br />

string recipient = "4799xxxxxx";<br />

string message = "My testmessage";<br />

int priceGroup = 0;<br />

int flash = 0;<br />

}<br />

SmsClass smsClass = new SmsClass();<br />

string res = smsClass.sendSms(sender, recipient, message, priceGroup, flash);<br />

int resint;<br />

if (int.TryParse(res, out resint))<br />

{<br />

Response.Write("SMS sent successfully (" + res + ")");<br />

}<br />

else<br />

{<br />

Response.Write("SMS failed. Error description: " + res);<br />

}<br />

26


ASP.NET – VB<br />

Download smsClass.vb: http://www.sendega.com/documents/sendega_sms_vbnet_library.txt<br />

Private Sub SmsFunc()<br />

Dim sender As String = "<strong>Sendega</strong>"<br />

Dim recipient As String = "4799xxxxxx"<br />

Dim message As String = "My testmessage"<br />

Dim priceGroup As Integer = 0<br />

Dim flash As Integer = 0<br />

Dim smsClass As New SmsClass()<br />

Dim res As String = smsClass.sendSms(sender, recipient, message, priceGroup,<br />

flash)<br />

Dim resint As Integer<br />

If Int32.TryParse(res, resint) Then<br />

Response.Write("Sms sent successfully. (" & res & ")")<br />

Else<br />

Response.Write("Sms failed. Error description: " & res)<br />

End If<br />

End Sub<br />

PHP 4<br />

Download <strong>Sendega</strong>_sms_php_4_library.php:<br />

http://www.sendega.com/documents/sendega_sms_php_4_library.txt<br />

<br />

<br />

Send sms<br />

<br />

<br />


PHP 5<br />

Download <strong>Sendega</strong>_sms_php_5_library.php:<br />

http://www.sendega.com/documents/sendega_sms_php_5_library.txt<br />

<br />

<br />

Send sms<br />

<br />

<br />


RECEIVE SMS AND MMS<br />

ASP – VBSCRIPT<br />

<br />

<br />

PHP<br />

<br />

29


HOW TO STORE BASE64 DATA AS IMAGE TYPE IN MICROSOFT SQL SERVER<br />

FUNCTION: BASE64TOBIN<br />

Add this function to your MS SQL database<br />

CREATE FUNCTION base64toBin (@bin64raw varchar(8000))<br />

RETURNS varbinary(8000)<br />

AS<br />

BEGIN<br />

DECLARE @out varbinary(6000)<br />

DECLARE @i int<br />

DECLARE @length int<br />

DECLARE @bin64char char(1)<br />

DECLARE @bin64rawval tinyint<br />

DECLARE @bin64phase tinyint<br />

DECLARE @bin64nibble1 tinyint<br />

DECLARE @bin64nibble2 tinyint<br />

DECLARE @bin64nibble3 tinyint<br />

SELECT @bin64phase = 0<br />

SELECT @i = 1<br />

SELECT @length = len(@bin64raw)<br />

IF right(@bin64raw, 1) '='SET @length = @length + 1<br />

WHILE @i < @length<br />

BEGIN<br />

SELECT @bin64char = substring(@bin64raw,@i,1)<br />

BEGIN<br />

IF ASCII(@bin64char) BETWEEN 65 AND 90<br />

SELECT @bin64rawval = ASCII(@bin64char)-65<br />

ELSE<br />

IF @bin64char LIKE '[a-z]'<br />

SELECT @bin64rawval = ASCII(@bin64char)-71<br />

ELSE<br />

IF @bin64char LIKE '[0-9]'<br />

SELECT @bin64rawval = ASCII(@bin64char)+4<br />

ELSE<br />

IF @bin64char = '+'<br />

SELECT @bin64rawval = ASCII(@bin64char)+19<br />

ELSE<br />

IF @bin64char = '/'<br />

SELECT @bin64rawval = ASCII(@bin64char)+16<br />

ELSE<br />

BEGIN<br />

SELECT @bin64rawval = 0<br />

SELECT @i = @length-1<br />

END<br />

END<br />

IF @bin64phase = 0<br />

BEGIN<br />

SELECT @bin64nibble1 = (@bin64rawval - @bin64rawval%4)/4<br />

SELECT @bin64nibble2 = @bin64rawval%4<br />

SELECT @bin64nibble3 = 0<br />

END<br />

ELSE<br />

IF @bin64phase =1<br />

BEGIN<br />

SELECT @bin64nibble2 = (@bin64nibble2*4) + (@bin64rawval - @bin64rawval%16)/16<br />

SELECT @bin64nibble3 = @bin64rawval%16<br />

IF @i


SELECT @out= @out + convert (binary(1),((16*@bin64nibble1) + @bin64nibble2))<br />

END<br />

ELSE<br />

IF @bin64phase =2<br />

BEGIN<br />

SELECT @bin64nibble1 = @bin64nibble3<br />

SELECT @bin64nibble2 = (@bin64rawval - @bin64rawval%4)/4<br />

SELECT @bin64nibble3 = @bin64rawval%4<br />

SELECT @out=@out+ convert (binary(1),((16*@bin64nibble1) + @bin64nibble2))<br />

END<br />

ELSE<br />

IF @bin64phase =3<br />

BEGIN<br />

SELECT @bin64nibble1 = (@bin64nibble3*4) + (@bin64rawval - @bin64rawval%16)/16<br />

SELECT @bin64nibble2 = @bin64rawval%16<br />

SELECT @out=@out+ convert (binary(1),((16*@bin64nibble1) + @bin64nibble2))<br />

END<br />

SELECT @bin64phase = (@bin64phase + 1)%4<br />

SELECT @i = @i + 1<br />

END<br />

RETURN(@out)<br />

END<br />

BASE64 TO BINARY PROCEDURE<br />

This procedure shows how to store base64 data as image type using the base64toBin function.<br />

CREATE PROCEDURE receiveMMS<br />

@msgid int,<br />

@mmsData text<br />

AS<br />

/*** Table schema used for test<br />

CREATE TABLE testData(msgid int, mmsData image, CONSTRAINT PK_testData primary key<br />

nonclustered (msgid))<br />

***/<br />

-- insert NULL (0x0) into the image field so that the TEXTPTR function will work<br />

INSERT testData(msgid, mmsData) VALUES (@msgid, 0x0)<br />

DECLARE @pointer varbinary(16)<br />

SELECT @pointer = TEXTPTR(mmsData) FROM testData WHERE msgid = @msgid<br />

DECLARE @buff varchar(2400)<br />

DECLARE @offset int, @imgOffset int<br />

SET @offset = 1<br />

SET @imgOffset = 0<br />

WHILE @offset

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!