Automatic SMS replies by script

The guide on this page is going to give you a brief introduction to how easy you can create an autoreply service that uses a script to answer by a defined action to the received messages. This service is capable of just reply with a predefined message, but you can write a script to forward the incoming messages to a specific phone number or do actions in case the sender phone number or the message itself matches with your predefined details. So, let's start it right now.

autoresponding sms script
Figure 1 - Autoresponding SMS script

How to write an SMS reply script (Easy commands)

To write an SMS reply script:

  1. Launch Ozeki SMS Gateway
  2. Select the Apps toolbar icon
  3. Install Autoreply app
  4. Write a test SMS script
  5. Specify the Sender address
  6. Enable the Connection
  7. Select Connect toolbar icon
  8. Add new SMPP client connection
  9. Check the new autoreply routing rule

Step 1 - Create an Autoreply connection

The first thing that you need to do in this guide, is to create the autoreply service connection in the SMS Gateway. So for that, first, click on the Apps icon on the toolbar in the main menu. Here you can see all the available connections, that you can create in the SMS Gateway. Now, but need to scroll down to the 'Incoming SMS message processing and autoresponding services' section, and here, like in Figure 2, click on the Install button of the Autoreply connection.

create an autoreply connection
Figure 2 - Create an Autoreply connection

Step 2 - Configure the Autoreply connection

In the configuration menu of the Autoreply connection, you need to specify a name for the connection in the first step. Then, you select the way, that the connection uses the script to handle the incoming messages. As you can see it in Figure 3, you can set the path for a script file, that the connection can use, or you can just type the script in the textbox below.

configure the autoreply connection
Figure 3 - Configure the Autoreply connection

Step 3 - Select an example script

The easiest way to create this autoreply service is to just select one from the available four example scripts from the textbox. Right now they can't be executed since all lines commented out by an '#' sign. The first example script sends a 'Thank you' message back to the sender.

SENDER Thank you for your message.

The second example script is capable of forwarding all the incoming messages to the defined phone number. The second line of the script shows how you can do that by first, defining the phone number, and then, MSG variable stores the incoming message which is in this case will be sent to that phone number.

+3620123223 MSG

The next example script activates only when the message comes from a specified phone number. This phone number can be defined in the first line of the script. Then, the script forwards the message to the phone number that is defined in the second line. The MSG variable stores the message.

+3620123223 MSG

The last example shows how you can do an action in case the message starts with a specific word. This example forwards the message to two other phone numbers defined in the second and third row. But it happens only in case when the message starts with the word 'important'. The word can be defined as the first row of the script demonstrates it.

+3620123223 SENDER: MSG
+3670322321 MSG

To follow this guide, just select the script that will forward the message to the defined phone number. Figure 4 demonstrates, how you need to write the script into the textbox to be able to operate with that script in case of an incoming message.

write a script for the autoreply service
Figure 4 - Write a script for the Autoreply service

Step 4 - Advanced configuration of Autoreply connection

The Autoreply connection can be further configured by setting a default sender address. This address will show up at the recipient side who receives the reply message. As you can see it in Figure 5, you can type here a phone number or an e-mail address which helps to identify the autoreply easy connection. If you finished the configuration, just click on OK.

advanced configuration of the autoreply connection
Figure 5 - Advanced configuration of the Autoreply connection

Step 5 - Enable the Autoreply connection

After you created the Autoreply connection, the next window is the main menu of the autoreply service. Here, you can modify the details of the connection anytime you want. To activate the service, you need to enable the connection here. For that, just click on the toggle as Figure 6 shows. The toggle is green now that indicates that the autoreply service is now active.

enabling the autoreply connection
Figure 6 - Enabling the Autoreply connection

Step 6 - Connect to the mobile network

By this point, you created and enabled your autoreply service, but to receive messages, you also need a connection that can connect to the mobile network and forward messages to your Ozeki system. To do that, click on Connect on the toolbar, and select the SMPP client as you can see it in Figure 7.

create an smpp client connection
Figure 7 - Create an SMPP client connection

In the configuration menu, you have to provide some details about the server. This is the server, that this SMPP client is going to use to handle SMS messages. So here, you need to type the host, port, and user account details. Then, you need to specify a telephone number for this connection (Figure 8). With this number, the connection can be identified, and able to send or receive messages. Lastly, you just need to click on OK to create the SMPP client connection.

configure an smpp client
Figure 8 - Configure an SMPP client connection

Step 7 - Wait for the messages

After setting up and enabling the autoreply service, now it is ready for the incoming messages. You can check that easily in the main menu of the SMS Gateway. Figure 9 shows that the creation of the autoreply service established a routing rule as well. This rule routes all the incoming messages to the autoreply connection and it will just do its job and forward the messages to the dedicated phone number.

route incoming messages to the autoreply connection
Figure 9 - Route incoming messages to the Autoreply connection

Figure 10 demonstrates how simple an autoreply service works. All you need to do here is to wait for a message forwarded to the telephone number, that you gave for the SMPP client connection. As soon as the client received the message, it forwards it straight to the autoreply service.

incoming messages routed to the autoreply service
Figure 10 - Incoming messages routed to the autoreply service

When the Autoreply service receives the message, the script, that you wrote for the service will be executed. In this case, it will forwards the incoming message to the specified phone number as Figure 11 shows that.

the autoreply service forwards the message
Figure 11 - The autoreply service forwards the message

More information