<< Click to Display Table of Contents >> Navigation: How to... > Scripting examples > Connector scripting examples > |
|
Auto reply SMS messages |
Learn how to use a C# or Visual Basic .NET script with Diafaan SMS Server to send an automatic reply to a received SMS message. This simple script sends a reply message every time an SMS message is received.
Script
The only adaptation to the skeleton script is in the OnMessageReceived event:
C# script:
private void OnMessageReceived(string fromAddress, string toAddress, string message, string messageType, string gateway, DateTime sendTime, DateTime receiveTime) "sms.text", "", "", "");
Visual Basic .NET script:
Private Sub OnMessageReceived(fromAddress As String, toAddress As String, _ message As String, messageType As String, _ messageId As String, smsc As String, _ sendTime As DateTime, receiveTime As DateTime) "sms.text", "", "", "") |
If you want to be sure the message is sent with the same (GSM Modem) gateway that received the message, add the gateway name to the PostSendMessage method:
C# script: string message, string messageType, string gateway, DateTime sendTime, DateTime receiveTime) "sms.text", gateway, "", "");
Visual Basic .NET script: message As String, messageType As String, _ messageId As String, smsc As String, _ sendTime As DateTime, receiveTime As DateTime) "sms.text", gateway, "", "") |