Support forum
Hello Yoyo,
You can use the 'Compile' button in the scripting editor of the Scripting Connector to check for syntax errors in the script.
In this script it shows an error with the $ character before the strings. This is because the scripting engine in Diafaan SMS Server uses an older version of C# that does not support interpolated strings. You will have use an alternative way to create the 'replyMessage' string, for instance with the 'String.Format' method.
Regards, Henk
4:05 am
I used the following code but its not working
private void OnMessageReceived(string fromAddress,
string toAddress,
string message,
string messageType,
string messageId,
string smsc,
string pdu,
string gateway,
DateTime sendTime,
DateTime receiveTime)
{
// Get current date and time
DateTime currentDateTime = DateTime.Now;
// Example database query (pseudo-code, replace with actual query logic)
string queryResult = QueryDatabase(message);
// Example HTTP request (pseudo-code, replace with actual HTTP request logic)
string httpResponse = MakeHttpRequest("http://example.com/api", message);
// Compose the reply message
string replyMessage = $"Thank you for your message received at {receiveTime}. " +
$"Query Result: {queryResult}. " +
$"API Response: {httpResponse}.";
// Send reply message
PostSendMessage(fromAddress, "", replyMessage, "", "", "", "", 0);
}
// Pseudo-function to demonstrate database query
private string QueryDatabase(string message)
{
// Implement your database query logic here
return "Example Database Result";
}
// Pseudo-function to demonstrate HTTP request
private string MakeHttpRequest(string url, string message)
{
// Implement your HTTP request logic here
return "Example HTTP Response";
}
Please help me?
1 Guest(s)
Add Reply
Add Topic
Offline
Quote