MSSQL API Documentation

The purpose of this API interface is to use Microsoft SQL Server as your primary database to send and receive SMS or MMS messages. Once you have completed the installation and configuration process, three tables (SMS_In, SMS_Out and SMS_Out_Log) will have been created under your desired database. Incoming messages will be inserted into SMS_In table and outgoing messages are inserted into the SMS_Out table, from where they are automatically sent out by the MSSQL client. Once a message is sent and after a delivery report has arrived, the message will be automatically moved to the SMS_Out_Log table, which will store the message contents along with delivery, cost and revenue information.

Recent versions of this service support Unicode characters, which makes it possible for customers with different language backgrounds or special characters to send and receive messages.

Requirements

  • Microsoft Windows operating system
  • Microsoft SQL Server 2000, 2005 or 2008.
  • Microsoft SQL client or any other methods to create database and tables.
  • ViaNett SQL service (download)

How does it work?

The client API application and appropriate SMS databases need to be installed and configured on your side (either on an application server, or on the same server where MS-SQL Server is installed). Then the API interface establishes a TCP connection with the ViaNett server on port 31337, 31338 or 31339. When ViaNett receives a message from an operator like Telenor or BT, it forwards the message to the MSSQL API. The client application inserts the message into a table called SMS_In. For sending SMS messages, the API client checks the SMS_Out table every 5 second for any new messages. (The 5 second interval is configurable, it could be 1 second or with MSMQ (event based with no delays)). If new messages are found, the messages will be sent to ViaNett and forwarded to the specified operator. The message activities like the content of the messages, their status or errors will be logged in SMS_Out_Log. (Please be aware that only one row will be logged in SMS_Out_Log per message even though the message is split into two or more parts if it exceeds the length limitation of a single SMS)

For more information, please contact the Customer Service.

How to start?

  1. Before any installation process, please open the required ports between your organisation and ViaNett. The service will open an outbound TCP connection to cpa.vianett.com at port 31337 (or 31338/9 if changed)
  2. Download the API interface from ViaNett's site and accept the stated terms and conditions VianettSQLService_Setup.msi (Version 1.0.84).
  3. Follow the installation process till your reach the end.
  4. Read the "Readme.txt"  file under the root folder of ViaNett SQL service.
  5. Create a database on your MS-SQL database server (e.g. SMSSERVER).
  6. Create tables under your database using the SQL script called SMS.sql provided in the ViaNett SQL service installation folder.
  7. Under the ViaNett SQL service folder,  find and open the Config.xml file in a text editor. Change the username/password  to your ViaNett SMS username and password. Please contact customer service if you don't have one.
  8. Also change CatalogName to your database name (e.g. SMSSERVER).
  9. Then you need to run the service. One way of doing that is by right clicking Computer on your desktop, choose Manage, which it will take you to Computer Management. Choose "Services" at the bottom, you should see "SMSServer SQL Client", click "Start" next to it.
  10. Under ViaNett SQL service, click on Logs where you see the service startup log.  You should see Something like 28.10.2009 13:54:25.973 Source:Connect Connected successfully

How to Send Messages via SMSSQL API

Sending  messages via your application is an easy process. You need to integrate an SQL query into your application that inserts the messages to the SMS_Out table. Then the API application sends the messages to the recipients every 5 seconds.  For example

SELECT TOP 1 * FROM SMS_Out 
INSERT INTO SMS_Out (FromAlpha, Tel, Msg) 
VALUES ('Test',47XXXXXXX,'This is a test message'

The Database Tables

There are three main tables in the database. The values of SMS_Out, SMS_In and SMS_Out_Log can be shown in the following table.

 SMS_In The incoming messages from the operators are kept in this table.
SMS_Out
This table is used to store message that you wish to send
which will then be sent by the API interface.
SMSM_Out_Log The  message activities like the content of the messages, their
status or errors will be logged in SMS_Out_Log.

SMS_In, SMS_Out and SMS__Out_Log

fromNumber
Sender’s phone number.
fromAlpha
Source address in alphanumeric format.
Tel
Destination mobile number.
Binary
For binary message, set to 1, and specify msg as hex string.
Header
For user header data (usually only for binary messages), hex string.
msg
The message.
MMS Zipped file with MMS contents.
PriceGroup
Please click here for the price group
Flash This is called SMSflash - the message will pop up on the handset without human interaction.
Operator
The operator you wish to choose, 0 is default.
ActivateReplyPath Number of minutes the reply path shall be valid for this message. If the value is set to 0, reply path is not activated.
ReplyPathID
The reply path id specified in the outgoing message, which will be returned in the incoming reply.
CampaignID Used to identify your content in ViaNett’s statistics. Unique campaigns are required for subscription services. 
Sent
Please don't change it. Used internally by the application, indicates if the SMS are sent or not.
SentDate Please don't change it, indicates when the message was sent by the service.
Delivered
The messages has been delivered.
ContentItemID Used for entertainment services provided by ViaNett. Use this as a reference to the content you want to send to the user. ViaNett will send the actual content.
ContentFriendTel
Used for entertainment services provided by ViaNett, together with the ContentItemID. Used to send the content to a different user than the billed user.
CountryID
Please don't change. Will be changed when the message are logged in the SMS_Out_Log. for example 1 for Norway, 2 for Sweden, etc
Nrq
Notification request. If you wish to receive delivery reports for the messages you send. (0 is No or 1 is Yes)
ReferenceId
For premium SMS traffic in some markets, the referenceid value on incoming message needs to be specified on the outgoing response message, or else the outgoing message will be rejected.
AckRecieved
Don’t change. Indicates that the service has received an acknowledgement from the server.
RetryCount
Don’t change. If the service is down, it keeps retrying
SendDate
Queue the message for later delivery
Optional1
Will be logged in the sms_Out_log. Can be used for your own parameters that you wish  to log together with the message.
Optional2
Will be logged in the sms_Out_log. Can be used for your own parameters you want to log together with the message.
RecievedTime (sic)
Time when the message was received.
ContentTypeId
Used for SMS content services like ring tones. Only relevant when the content is provided from ViaNett.
ContentPricegroup
Used for SMS content services. Only relevant when the content is provided from ViaNett.
ContentFriendTel
Used if the content should be sent to a different phone than the billed phones. Only relevant when the content is provided from ViaNett.
DestTel
Phone number of the incoming messages.
OK
OK=0, the message has been rejected by ViaNett or the network. No cost or payouts. Ok=1, the message has been accepted by ViaNett and the network. The message will have a cost or revenue.
ErrorCode
The status of the message. Indicate the reason why it has been rejected/accepted.
SentWithOperator
Indicate what the route number that has been used for distribution of the message.
Sent
Indicate that the messages have been sent. 1 for sent, and 0 for queued for sending. Only relevant for SMS_Out_Log.
ConsumerPrice
How much the end-user has been charged inclusive taxes.
NetPrice
The payout from the network exclusive taxes.
CPARevenue
The payout from ViaNett exclusive taxes
cut
The customer percentage of the revenue/cost.
ErrorDescription
Textual description of the error code
ContentItemID
Only relevant for content provided by ViaNett. Indicates the content id.
CPAcontentCost
How much you will be charged for the content.
SMSCID
ViaNett internal message ID
DeliveryDate
Date of delivery
DeliveryStatus
Rejected, expired, delivered or not
MCC
Mobile country code
MNC
Mobile network code

More Information

For a free Demo account, please register here.
To contact Sales or  Customer Service, please click here.