How can we help?

Introduction


In C#, VB.Net, C++ and other compiled languages the namespace for most classes is AXMMCFGLib instead of AxMmServer. For interpreted languages like VBScript, JavaScript or Powershell it is AxMmServer.

The Auron SMS Server API is an interface that wraps around the SMS Server database. Find full working examples of how to use this API on github.

Use this API to:

  • Implement triggers: as soon as a new message arrives in the system, the SMS Messaging Server will trigger a VBScript program (or multiple VBScript programs), based on a condition. This trigger can use the API to change the status of the incoming message, to create a reply message, etc.
  • Send SMS messages from a 3rd party application.
  • Send out a batch of SMS messages every morning, for instance to notify IT Administrators about the completion status of a backup, or to tell a department about upcoming meetings on that day.
  • Build a customized user interface with various message views.

VBScript sample: Read SMS numbers from an MS Access database, and use these with SMS Server

To demonstrate how the API can be used, we start with a simple VBScript sample that shows how to send out SMS messages using mobile numbers from an MS Access Database.

Let’s take an MS Access Database ‘Students.mdb’ that contains the following table:

ID# FirstName LastName MobileNumber
8000 John Doe +440000000
8001 Edward Smiths +440000001
8002 Peter Williams +440000002

The following VBScript program reads the SMS numbers from the above database and creates new SMS message record for each number:

  Option Explicit
  
  Dim objConstants, objMessageDB, objMessageOut, strDatabase, objDBConnection, RS
  
  Set objConstants  = CreateObject( "AxMmServer.Constants" ) 
  Set objMessageDB  = CreateObject( "AxMmServer.MessageDB" ) 
  
  strDatabase = InputBox( "Enter the path to the Students MS Access database", _
                          "Enter Path", "c:\temp\students.mdb" )
  If( strDatabase = "" ) Then
     WScript.Echo "Finished. "
     WScript.Quit
  End If
  
  objMessageDB.Open
  WScript.Echo "Open Server database, result: " & objMessageDB.LastError
  If( objMessageDB.LastError <> 0 ) Then
     WScript.Echo "Finished. "
     WScript.Quit
  End If
  
  Set objDBConnection = CreateObject( "ADODB.Connection" )
  objDBConnection.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & strDatabase & ";"
  
  Set RS = objDBConnection.Execute( "SELECT * FROM Students" )
  
  While Not RS.EOF
     Set objMessageOut = CreateObject( "AxMmServer.Message" )
     objMessageOut.DirectionID = objConstants.MESSAGEDIRECTION_OUT
     objMessageOut.TypeID      = objConstants.MESSAGETYPE_SMS 
     objMessageOut.StatusID    = objConstants.MESSAGESTATUS_PENDING
     objMessageOut.ToAddress   = RS( "MobileNumber" )
     objMessageOut.ChannelID   = 0  ' Any available SMS channel
     objMessageOut.Body        = "Hello, world!"
     objMessageDB.Save objMessageOut
     WScript.Echo "Message #" & objMessageOut.ID & " saved, result: " & _
       objMessageDB.LastError
  
     RS.MoveNext
  WEnd
  
  objMessageDB.Close
  WScript.Echo "Server database closed."
  
  objDBConnection.Close
  
  WScript.Echo "Finished."

VB .NET sample: Read SMS numbers from an MS Access database, and use these with SMS Server

The same sample as in 8.1.1., converted to VB .NET:

  Module Module1
    Const STR_STUDENTSDATABASE = "c:\students\students.mdb"
  
    Sub Main()
  
      Dim objMessageDB As New AXMMCFGLib.XMessageDB()
      Dim objMessageDB As New AXMMCFGLib.XConstants()
      Dim objMessage As New AXMMCFGLib.XMessage()
      Dim objConn As New ADODB.Connection()
      Dim objRs As New ADODB.Recordset()
  
      objMessageDB.Open()
      Console.WriteLine("Open, result: " & objMessageDB.LastError)
      If (objMessageDB.LastError <> 0) Then
        GoTo _EndMain
      End If
  
      objConn.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & _
            STR_STUDENTSDATABASE & ";"
      objConn.Open()
      objRs = objConn.Execute("SELECT * FROM Students")
  
      Do While Not objRs.EOF
        Console.WriteLine(objRs("MobileNumber").Value)
  
        Set objMessage = New AXMMCFGLib.XMessage()
        objMessage.DirectionID = objConstants.MESSAGEDIRECTION_OUT
        objMessage.TypeID = objConstants.MESSAGETYPE_SMS
        objMessage.StatusID = objConstants.MESSAGESTATUS_PENDING
        objMessage.ToAddress = objRs("MobileNumber").Value
        objMessage.ChannelID = 0  ' Any available SMS channel
        objMessage.Body = "Hello, world!"
        objMessageDB.Save(objMessage)
        Console.WriteLine("Message #" & objMessage.ID & " saved, result: " & _
            objMessageDB.LastError)          
        
        objRs.MoveNext()
      Loop
  
      _EndMain:
        objMessageDB.Close()
  
    End Sub
  End Module