ℹ️ The Auron SMS Server is now Auron Omni. Learn more here.

How can we help?

Run a campaign from the command line


You can find out how to configure and run campaigns from the Auron Omni Manager here.

This document explains how to run an existing campaign from the command line.

1. Create a script to run the campaign

First we create a small script that runs the campaign. In this example we use VBScript.

Copy and paste the following script into Notepad and save it as C:\AuronScripts\SendCampaign1.vbs.

Create the AuronScripts directory if it does not exist.

Set objCampaignManager = CreateObject("AxMmServer.CampaignManager")

nBatchID = objCampaignManager.Run("CAMPAIGN1", "Automated run")
If objCampaignManager.LastError <> 0 Then
  WScript.Echo objCampaignManager.LastErrorDescription
  WScript.Quit 1
End If

WScript.Echo "Campaign completed; BatchID: " & nBatchID

The script uses the Auron Omni API to create an instance of the CampaignManager and run the specified campaign.

If you are familiar with scripting, you can also use JavaScript or PowerShell.

The text CAMPAIGN1 must be replaced with the name of your campaign.

2. Run the script

To run the campaign, execute the script.

There are two ways to run it:

  1. Double click the script in Windows Explorer
  2. Run it from the command line using cscript

When you run it from Explorer, WScript.Echo shows pop ups. When you run it from the command line, output is printed in the console. The command line is usually more convenient.

To run the script from the command line, open a command prompt by pressing Windows + R and typing cmd.

Then run:

cscript c:\AuronScripts\SendCampaign1.vbs

The script runs and displays the BatchID when it completes.

Run campaign from command line - Result

Run campaign from command line – Result

3. Optional improvements

You can customize the message text used in the campaign. This is useful when you want to reuse the same set of recipients but send different messages without creating multiple campaigns.

To customize the message, update the script like this:

Set objCampaignManager = CreateObject("AxMmServer.CampaignManager")

objCampaignManager.CustomSmsMessage = "Hello %FirstName%, this message is customized at runtime"
'objCampaignManager.CustomSubject = "Regarding %Subject%"
'objCampaignManager.CustomPlainTextMessage = "Hello %FirstName%, this message is customized at runtime"
'objCampaignManager.CustomHtmlMessage = "Hello <strong>%FirstName%</strong>, this message is customized at runtime"

nBatchID = objCampaignManager.Run("CAMPAIGN1", "Automated run")
If objCampaignManager.LastError <> 0 Then
  WScript.Echo objCampaignManager.LastErrorDescription
  WScript.Quit 1
End If

WScript.Echo "Campaign completed; BatchID: " & nBatchID

In VBScript, lines starting with a single quote () are comments. They are ignored when the script runs. To activate a line, remove the quote.

Depending on whether you send SMS or e-mail, you can enable the appropriate objCampaignManager.Custom… properties. You can also use the same placeholders to reference fields from the data source.