ActiveXperts SMS Messaging Server

Quicklinks

Create an SMS message using the SMS Messaging Server API - Visual Basic

SMS Messaging Server is an SMS messaging framework that enables companies to send, receive and process SMS- and e-mail messages. The framework is designed support virtually any scenario where low-and high volume SMS messaging is required. Use SMS Messaging Server in the following scenarios:

  • Mobile users query a database; results are sent back via SMS or e-mail;
  • Mobile users receive important information via SMS or e-mail while they are away from the office;
  • Stock prices are sent automatically via SMS and/or e-mail, daily;
  • Remote workers can update their worksheet from a remote location trough SMS;
  • ICT administrators restart/reboot servers and/or daemons from remote by SMS;
  • Setup an SMS voting system, supporting SMS and/or e-mail;
  • Etc.

SMS Messaging Server can be well integrated into VBScript environments. This document describes how the SMS Messaging Server can be integrated into your own projects.


Introduction

In this example we are going to create a Visual Basic sample page to create an SMS using the ActiveXperts SMS Messaging Server API. The SMS Messaging Server service will send the message you created in the database.

Step 1: Download and install SMS Messaging Server

Download ActiveXperts SMS Messaging Server from the ActiveXperts Download Site and start the installation. The installation guides you through the installation process.

Step 2: Create a new Visual Basic project

Launch 'Microsoft Visual Basic' from the Start menu, and choose 'New' from the 'File Menu'. The 'New Project' dialog appears. Select 'Standard Exe' and click 'OK':

Visual Basic

(Click on the picture to enlarge)

Step 3: Refer to the SMS Messaging Server Library and create the objects

A new Project is created, with a blank form.

First, you must add a reference to the SMS Messaging Server Library in the project to be able to use the SMS Messaging Server objects. To do so, choose 'References...' from the 'Project' menu. In the 'References' dialog that pops up, enable the 'ActiveXperts SMS Messaging Server Type Library' reference as shown in the following picture:

Visual Basic

(Click on the picture to enlarge)

Click 'OK' to close the 'References...' dialog.

Then, select the Project form and choose 'View Code' from the context menu:

Visual Basic

(Click on the picture to enlarge)

From the Code window, select 'Form'. The Private Sub 'Form_Load()' will be displayed now. In the 'Form Load' function, create the GSM objects in the following way:

Set objMessageDB = CreateObject("AxMmServer.MessageDB") Set objConstants = CreateObject("AxMmServer.Constants")

Step 4: Create the SMS Message

The following code will create an empty record in the database where the message will be stored.

' Create new message in the Message Database Set objMessage = objMessageDB.Create PrintResult ("Create") If (objMessageDB.LastError <> 0) Then CreateSmsMessage = 0 Exit Function End If

Step 5: Set the message settings

The following code wil setup the settings for the message.

MsgBox "Message successfully created, recordID: " & objMessage.ID objMessage.DirectionID = objConstants.MESSAGEDIRECTION_OUT objMessage.TypeID = objConstants.MESSAGETYPE_SMS objMessage.StatusID = objConstants.MESSAGESTATUS_PENDING objMessage.ChannelID = 0 ' First available SMS channel objMessage.ScheduledTime = "" ' To indicate immediate schedule. ' To schedule 1 day and 2 hours in advance, specify "+1d2h0m" ' To schedule on specific date/time, specify 12/25/2005 07:30 objMessage.ToAddress = TextRecipient.Text objMessage.Body = TextMessage.Text

Step 6: Save the SMS Message

The following Visual Basic code shows how to save an SMS message:

' Save the new values that were just assigned objMessageDB.Save objMessage PrintResult ("Save") If (objMessageDB.LastError <> 0) Then CreateSmsMessage = 0 Exit Function End If

You can download the full source code of this project from the ActiveXperts FTP site: ftp.activexperts-labs.com/samples/sms-messaging-server. There are many other working samples included with the product or on the FTP site.

NOTE: Demo Projects are created with Microsoft Visual Studio 2008

The SMS Messaging Server project ships with a set of Microsoft Visual Studio .NET samples. The projects are created with Microsoft Visual Studio 2008.

Users with a later version of Microsoft Visual Studio can open such a project. The Visual Studio Conversion Wizard will guide you through the process of converting the project to the version used.