Trigger on incoming messages and state changes
With triggers you can script what should happen when receiving a message or when a message reaches a certain status.
Triggers are incredibly versatile. Read more about how to write triggers and how you can test them here. Read more about message states here.
For most common actions the Auron SMS Server includes ready made scripts. Find a complete list of these trigger templates here.
To view triggers:
- Open the SMS Server manager
- Click on ‘Triggers’ in the tree view on the left.
There are three types of triggers:
- VBScript – This will run a custom Visual Basic Script
- SQL Script – This will run a custom SQL query or starts a custom stored procedure
Creating a new trigger
You can create a new trigger by clicking ‘New Trigger’. This will start the trigger wizard.
The first page of the trigger wizard is the trigger select screen. This is where you select the template to start out with.
Empty triggers will just generate the skeleton of a script. The other templates will walk you through a couple of steps to collect all information required to automatically create a working script.
This means that for most common use cases no programming code is required at all.
The following use cases can be setup by using generated scripts and require either no programming or at all or very little programming:
- Automatically forwarding a message. E.g SMS to E-mail, E-mail to SMS or convert new files on the filesystem to SMS messages, etc.
- Automatically replying to a message, optionally based on a Web query or a database query.
- Applying the status of a delivery report to the original message.
- Authorizing logins on the SMPP Server channels.
- Subtracting credits for incoming SMPP Server messages.
- Forwarding the message delivery status to SMPP Server clients.
Edit an existing trigger
A trigger has two parts:
- The trigger script
- The trigger condition
Find out more about how conditions work here.
Both of these can be edited and fine-tunes after the trigger is generated by the trigger wizard. Clicking the ‘Edit’ icon on the right side of the trigger view will open the trigger editor.
The dialog has two tabs. The first tab to open edits the condition of the trigger. The condition of the trigger is a SQL expression that will capture all messages that this condition will trigger on.
The message type of the trigger and the message status are already a part of the condition and do not need to specified in the SQL expression.
This is where you can edit the script or select a different script. The ‘Function’ specifies the function in the script that is called by the SMS Server if the trigger condition matches.
The ‘Support attachments’ check-box is relevant when processing e-mail messages. If e-mail attachments are not important in the trigger script then it makes sense to leave this unchecked to save processing time.
With SQL triggers the script is not stored in an external file but instead it’s stored in the database.
You can find out which fields are available and insert them automatically by using the ‘Insert Field’ button.