Event Task (SMS Auto Reply/SMS Auto Forward)

(Feature Available on PC SMS Gateway Server 4.2)

 

Table of content

1. Introduction

2. Define new Auto Reply Task

2.1 Setting Filter

2.1.1 Message Filter

2.1.2 Sender Filter

2.1.3 Device Filter

2.2. Setting Send SMS

2.3 Setting Execute SQL

3. Example

3.1 Example 1:Saving Received SMS Mobile Number Into Phonebook

 

1. Introduction

The PC SMS Gateway Server Event Task is triggered when the SMS is loaded from device, the task are Send SMS and Execute SQL, optionally the Message Keyword Filter, Sender filter and Device Filter could be used.

Some example of the implementation is SMS auto reply and SMS auto forward.

SMS auto reply which is reply the received SMS and optionally could be filtered by message keyword, sender ( phonebook contact, group, or mobile number) , and device.

SMS auto forward which is reply the received SMS and optionally could be filtered by message keyword, sender ( phonebook contact, group, or mobile number) , and device.

 

2. Define New Auto Reply Task

To create an Event Task, from main form click Settings on toolbar then after the Application Settings shows up select Task tab.

Auto Reply Task

Picture 1. Open Task

Click Add button to define new Task Propeties. After Task Properties shows up, checked the Enabled Task and select Event Task.

Define New Auto Reply Task

Picture 2. Define new Event Task

 

2.1 Setting Filter

There are three filter on Event Task reply that optionally can be used, Message Filter, Sender Filter and Device Filter.

 

2.1.1 Message Filter

Message keyword filter purpose is to filter the SMS, so only the SMS message that match the criteria will be triggered the Event Task to do some actions.

Auto Reply Task Properties

Picture 3. Define Message Filter

 

2.1.2 Sender Filter

Sender Filter purpose is to filter the SMS, so only the SMS sender that match the criteria will be triggered the Event Task to do some actions.

There are two type of sender filter, Allowed List and Restricted List.

If Allowed List is used and Restricted List is not used, the Sender Filter only pass the SMS sender whicsh is included on Allowed List.

if Allowed List is not used and Restricted List is used, the Sender Filter only pass the SMS sender which is not included on Restricted List.

if both Allowed List and Restricted List is used, the Sender Filter only pass the SMS sender that included on Allowed List and not included in the Restricted List.

 

2.1.3 Device Filter

Device Filter purpose is to filter the SMS, so only the SMS received by some Device that match the criteria will be triggered the Event Task to do some actions.

There are two type of Device Filter, Allowed List and Restricted List.

If Allowed List is used and Restricted List is not used, the Device Filter only pass the SMS from device which is included on Allowed List.

if Allowed List is not used and Restricted List is used, the Device Filter only pass the SMS from device which is not included on Restricted List.

if both Allowed List and Restricted List is used, the Device Filter only pass the SMS from device that included on Allowed List and not included in the Restricted List.

 

2.2. Setting Send SMS <!-- -->

To setting Send SMS , choose the Send SMS tab.

Send SMS : Checked the Send SMS to enabled SMS Send when the Event Task triggered.

Sender(Auto Reply) : Checked the Sender(Auto Reply) to enabled reply to sender

Use recipient list : Checked the Use recipient list to enabled send SMS to some recipients.

 

Device For Sending SMS : Select the options which method for sending SMS:

  • Reply using same device : Reply the SMS using the same device that receive the SMS.
  • Specify device : Select the device for sending SMS.

 

SMS Message : Select the message type.

  • Specify message : Set the custom SMS message
  • Incoming message : Set the SMS Message using the Message from received SMS, the example is on picture 4.
  • Field Value From SQL Table Query : The Field Value are taken from a field in first row of the SQL Result Set query, the example is on picture 5.

From the example on picture 5, the Database Connection are Server Database Connection (using SMSgee PC SMS Gateway Server Database) and the SQL Query are

SELECT CONTACTNAME FROM PHONEBOOK
WHERE MOBILENUMBER='<#INBOXMESSAGE>'

The<#INBOXMESSAGE>will by changed by the application with the SMS Message from the received SMS. For example if SMS Message from the received SMS are +6281320573350, the SQL query send by the application to the database are :

SELECT CONTACTNAME FROM PHONEBOOK
WHERE MOBILENUMBER='+6281320573350'

If +6281320573350 listed on the SMSgee PC SMS Gateway Server Phonebook , the reply SMS Message are the CONTACTNAME from the SMSgee PC SMS Gateway Server Phonebook.

SMS Gateway Server event task send sms

Picture 4. SMS Message using "Specify Message"

 

SMS Message from SQL Table/Query

Picture 5. SMS Message usingField Value from SQL Table/Query

 

 

2.3 Setting Execute SQL

When Execute SQL is Enabled the SQL Script wil be executed if the Event Task is triggered.

The Database conection could be using Server Database Connection(using SMSgee PC SMS Gateway Server Database) or Custom Connection (another database).

Execute SQL when SMS received

Picture 6. Execute SQL

3. Example

3.1 Example 1: Saving Received SMS Mobile Number Into Phonebook

3.1.1 Scenario

This example will implement the "Task" with following Scenario:

a. For the SMS received with following format:

   REG:<first name>:<last name>:<city>

b. The Task will saving the SMS mobile number into phonebook and sending Auto Reply ,

 

c.  The data will be inserted into phonebook , described on Picture 7. And added to phonebook group named 'GROUP1', described on Picture 8

 

data phonebook

Picture 7. Contact inserted into phonebook

 

group

Picture 8. Contact added into group

 

d.The Auto Reply message is

  Hi <first name>! Thank you for contacting us.

 

e. SMS replied to sender using the device on server which receive the SMS.

 

 

3.1.2 Implementation

 To implement this scenario, the steps to settings the Task are :

a. Create a new Group , by Inserting new record into CONTACTGROUP table. Set the CONTACTGROUPID as'100' and CONTACTNAME as 'Group1'.(example on Picture 9)

Phonebook Group Name

Picture 9a. Create new group named GROUP1

Group ID

Picture 9b Each Group Have Unique Group ID (generated automatically)

 

b. Create New Task.(Described on Picture 10) The steps are :

    1. Open "Settings" form by clicking "Settings" Icon the application Main Menu

    2. On the "Settings" form choose "Task" tab.

    3. On "Task" tab, click Add to create new "Task"

 

Application Settings Task

Picture 10. Task

 

c. Settings Task (Desccribed on Picture 11)

    1. To enabling the task, enabled the "Enabled Task" Checkbox.

    2. Set the Task as Event Task, by Choosing "Event Task" on the "Task Type"

d. Settings Task:Filter (Desccribed on Picture 11)

    1. Select "Filter" tab

    2. On the "Message Keyword Filter" box, enabled the "Use Message Keyword Filter" checkbox. Then select 'Begin With' radio button.

    3. Set Message Keyword Filter edit box with : REG:   

 

 

Task Filter

Picture 11. Task:Filter

 

e. Settings Task: Send SMS (Desccribed on Picture 12)

   1. Select "Send SMS" tab

   2. To enabling Send SMS, enabled the "Send SMS" check box

   3. To Auto Reply the SMS, enabled the "Sender (auto reply)" check box on the SMS Recipient box.

   4. To set device used for sending SMS, select "Reply using same Device"

   5. To set the Auto Reply Message, set the SMS Message on SMS Message box with : Hi <#INBOXMESSAGEPARSING#2#:>! Thank you for contacting us

 

Task Send SMS

Picture 12. Task:Send SMS

 

f. Setting Task:Execute SQL (Desccribed on Picture 13)

   1. Select "Execute SQL" tab

   2. To enabled Execute SQL to execute SQL Command when the SMS received, enabled the "Execute SQL" checkbox

   3. Since the Phonebook table is located on SMS Database, select "Server Database Connection"

   4.Set the "SQL" with :

   5. Notes: the value '100' for CONTACTGROUPID  is the Primary ID key of  Group1 created on step a. In this example CONTACTGROUPID is {D9FF3BD0-8A6A-4674-A5A1-F66D9AA16270}   , the CONTACTGROUPID is random and generate automatically so it will be different on your case

 

 

 

 

<#SQL>
INSERT INTO PHONEBOOK(CONTACTID,CONTACTNAME,FIRSTNAME,LASTNAME,CITY,MOBILENUMBER)
VALUES('<#INBOXMOBILENUMBER>','<#INBOXMESSAGEPARSING#2#:>'+' '+'<#INBOXMESSAGEPARSING#3#:>','<#INBOXMESSAGEPARSING#2#:>','<#INBOXMESSAGEPARSING#3#:>','<#INBOXMESSAGEPARSING#4#:>','<#INBOXMOBILENUMBER>')
</#SQL>

<#SQL>
INSERT INTO CONTACTGROUPMEMBER(CONTACTGROUPID,CONTACTID) VALUES('{D9FF3BD0-8A6A-4674-A5A1-F66D9AA16270}','<#INBOXMOBILENUMBER>')
</#SQL>

 

 

Task: Execute SQL

Picture 13. Task:Execute SQL

 

g. Click OK to save the Task.

   

 

3.1.3 Testing Scenario

The testing scenario will check whether the Task has been implemented correctly.

 

1. Send SMS to server (PC SMS Gateway Server) , with the Message , REG:John:Doe:New York

2. The server will saving the SMS data to Phonebook

with:

Name : John Doe

Mobile Number : (SMS sender Mobile Number)

First Name : John

Last Name : Doe

City : New York

 

3. The server will saving the contact into 'GROUP1'.

4. The Sender will receive the SMS Message: Hi John! Thank you for contacting us.

 

3.2 Example 2: Deleting Received SMS Mobile Number From Phonebook

3.2.1 Scenario

This example will implement the "Task" with following Scenario:

a. For the SMS received with following format: UNREG

b. The mobile number will be deleted from Phonebook if the mobile number are member of GROUP1.(If contact deleted from Phonebook automatically deleted from group)

c.The Auto Reply message will be sent if the mobile number are member of GROUP1.

Your mobile number <Mobile Number> has been deleted from phonebook.

d. SMS replied to sender using the device which receive the SMS.

 

3.2.2 Implementation

To implement this scenario, the steps to settings the Task are :

a. For prequisities, done the implementation(3.1.2) on example 3.1.

b. Create New Task. The steps are :

    1. Open "Settings" form by clicking "Settings" Icon the application Main Menu

    2. On the "Settings" form choose "Task" tab.

    3. On "Task" tab, click Add to create new "Task"

c. Settings Task

   1. To enabling the task, enabled the "Enabled Task" checkbox.

   2. Set the Task as Event Task, by Choosing "Event Task" on the "Task Type"


d. Settings Task:Filter (Desccribed on Picture 14 )

     1. Select "Filter" tab
 
     2. On the "Message Keyword Filter" box, enabled the "Use Message Keyword Filter" checkbox. Then select 'Exact Phrase' radio button.

     3. Set Message Keyword Filter edit box with UNREG

     4. Enabled ' Allowed List' by checked the checkbox on Sender Filter. Then add GROUP1 to Filter List.

Sender Filter

Picture 14. Sender filter list.



e. Settings Task: Send SMS

    1. Select "Send SMS" tab

    2. To enabling Send SMS, enabled the "Send SMS" check box

    3. To Auto Reply the SMS, enabled the "Sender (auto reply)" check box on the SMS Recipient box.

    4. To set device used for sending SMS, select "Reply using same Device"

    5. To set the Auto Reply Message, set the SMS Message on SMS Message box with :

             Your mobile number <#INBOXMOBILENUMBER> has been deleted from our phonebook.


f. Setting Task:Execute SQL

    1. Select "Execute SQL" tab

    2. To enabled Execute SQL to execute SQL Command when the SMS received, enabled the "Execute SQL" checkbox

    3. Since the Phonebook table is located on SMS Database, select "Server Database Connection"

    4.Set the "SQL" with :

                              <#SQL>
                             DELETE FROM PHONEBOOK WHERE MOBILENUMBER='<#INBOXMOBILENUMBER>'
                              </#SQL>

g. Click OK to save the Task.

 


3.2.3 Testing Scenario
 

The testing scenario will check whether the Task has been implemented correctly.

1. Done the 3.1.3 Testing Scenario

2. Send SMS message , UNREG .To server (PC SMS Gateway Server) from phone  used for 3.1.3 Testing Scenario.

3. The server will delete the contact if the mobile number of received SMS available on Phonebook.

4. If the mobile number of received SMS is member of GROUP1 , the sender will receive the SMS Message: Your mobile number <Mobile Number> has been deleted from our phonebook.