Support forum

Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_TopicIcon
Send sms to a number list store in a csv file
sp_NewPost Add Reply sp_NewTopic Add Topic
June 16, 2017
3:24 pm
Henk Helmantel
Admin
Forum Posts: 1488
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

Hello Sam,

If you are not a programmer then I don't recommend using scripts in Diafaan SMS Server. To get the example scripts to work you need at least a basic understanding of the C# or Visual Basic.Net programming languages.

Regards, Henk

June 16, 2017
12:09 pm
Sam
Guest
Guests

hello, im very new to using the sms server. i would like to send an sms to numbers stored in a csv file.i have downloaded the scripting pack but am so clueless on how i should make it work. can anyone please help

May 24, 2017
11:59 pm
Leo
Guest
Guests

It worked ok, thanks. I had to make minor changes to the code.

May 24, 2017
11:21 am
Henk Helmantel
Admin
Forum Posts: 1488
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

The script snippet is based on the headers of the 'SendMessagesFromCSVFile.cs' script from the Scripting Pack. As a minimum you have to add the following lines from the the 'SendMessagesFromCSVFile.cs' script to your own script:

- On line 3:
// AddReference Microsoft.VisualBasic.dll

- On lines 9 and 10:
using System.IO;
using Microsoft.VisualBasic.FileIO;

Regards, Henk

May 23, 2017
6:34 pm
Leo
Guest
Guests

Hello, now it says that this "TextFieldParser" cannot be found.

I also had to change this line to work, Does that have to do with the "TextFieldParser" error ?

if (System.IO.File.Exists(csvNumbersFileName))

sorry, Im not a programmer.
Thanks

May 23, 2017
10:36 am
Henk Helmantel
Admin
Forum Posts: 1488
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

I have updated the script snippet to eliminate the error message.

Regards, Henk

May 22, 2017
7:29 pm
Leo
Guest
Guests

Thanks for your response, the script outputs this error on line 27.

Unexpected symbol `=' in class, struct, or interface member ...

that would be here:
csvFileName = @"c:\temp
umbers.csv";

Thanks again

May 20, 2017
11:47 am
Henk Helmantel
Admin
Forum Posts: 1488
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

The following script snippet reads a CSV file when a message is received from number '+5555555555' and forwards the message to all numbers in the first field of each row of the CSV file. The snippet is based on the 'AddReference' and 'using' header definitions in the 'SendMessagesFromCSVFile.cs' script example file.

private string csvNumbersFileName = @"c:\temp\numbers.csv"; private void OnMessageReceived(string fromAddress, string toAddress, string message, string messageType, string messageId, string smsc, string pdu, string gateway, DateTime sendTime, DateTime receiveTime) { try { if (fromAddress == "+5555555555") { if (File.Exists(csvNumbersFileName)) { using (TextFieldParser parser = new TextFieldParser(csvNumbersFileName)) { parser.TextFieldType = FieldType.Delimited; parser.SetDelimiters(","); while (!parser.EndOfData) { //Processing row string[] fields = parser.ReadFields(); // The first field in the row is the destination number if (fields.Length >= 1) { PostSendMessage(fields[0], "", message, "", "", "", "", 0); } } } } } } catch (Exception ex) { PostEventLog(ex.Message, ex.ToString(), EventLog.Error); } }

Regards, Henk

May 19, 2017
3:34 am
Leo
Guest
Guests

Hello, I managed to accomplished what I wanted. I adapted the default code to received a message,
filter it and forward it to different numbers.

I have the number list store in a csv file, It would be great to read de csv file, that only contains
cell numbers, and forward the message to that list, so I dont have to add each number manually.
Here is the code:

private void OnMessageReceived(string fromAddress, string toAddress, string message, string messageType,
string messageId, string smsc, string pdu, string gateway,
DateTime sendTime, DateTime receiveTime)
{

if ( fromAddress == "+5555555555") {

PostSendMessage("22222222222", fromAddress, message, messageType, "", "", "", 0);
PostSendMessage("11111111111", fromAddress, message, messageType, "", "", "", 0);
//
// TODO: Add code to handle received SMS messages
// e.g.
//PostSendMessage(fromAddress, "", "We have received your message", "sms.text", "", "", "", 0);
//
} }

I hope you can help,
Thanks

May 1, 2017
12:09 pm
Henk Helmantel
Admin
Forum Posts: 1488
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

Hello Leo,

Diafaan SMS Server does not have the built-in functionality to import SMS messages from a CSV file and send them. But it is possible to use a Scripting Connector with a custom script to import CSV files.

You can find an example C# script to import CSV files in the Scripting Pack on the download page. The script is called 'SendMessagesFromCSVFile.cs', it is located in the 'ConnectorScripts' folder of the ZIP file.

Regards, Henk

April 29, 2017
8:12 pm
Leo
Guest
Guests

Hello, congratulations, great software. I want to send sms to a number list stored in a csv file. I want to setup Diafaan to received a sms and automatically activate itself to send the content of it to the list. How can I do that if possible ?
thanks

Forum Timezone: Europe/Amsterdam

Most Users Ever Online: 529

Currently Online:
5 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Member Stats:

Guest Posters: 672

Members: 0

Moderators: 0

Admins: 1

Forum Stats:

Groups: 2

Forums: 3

Topics: 1141

Posts: 3899

Newest Members:

, Henk Helmantel

Administrators: Henk Helmantel: 1488