How to change the SMS text using C# algorithm

This article talks about how you could change the SMS text with the help of a C# algorithm. It will start with creating a new modifier and will end with sending a test message. With this solution, you will be able to automatically modify all messages sent in a connection. This tutorial requires minimal knowledge of SMS sending technologies and minimal knowledge of coding in c#. The tutorial is easy to follow, and it is very detailed. Do not waste more time, let’s start sending SMS messages.

How to change the SMS text with C# (Quick steps)

To change the SMS text with C#:

  1. Launch Ozeki SMS Gateway
  2. Select Routes toolbar icon
  3. Open outgoing route's Advanced menu
  4. Create new Modifier
  5. Choose Formula
  6. Write C# algorithm to change the SMS text
  7. Send test SMS message
  8. Check the logs

Click the Routes button

To write a script that changes the outgoing SMS messages automatically, you first need to create a modifier. To access the Modifier creator panel, open the list of routes with the Routes button located on the toolbar of the Ozeki SMS Gateway (Figure 1). This will open a list that contains all the created routes.

open routing table
Figure 1 - Open routing table

Open the Advanced menu

To customize any route, you need to open the Advanced menu of it. To do so, search for the Advanced button located in the Advanced column (Figure 2). Click it and it will open the menu where you could deeply customize the routes preferences.

outgoing route advanced menu
Figure 2 - Outgoing route Advanced menu

Add a new formula

To reach the modifications panel, search for the Modification tab. Click it and it will open the list of all the possible modifications. To create one, click the Create new Modifier button. This will open a panel on the right where you could choose which modifier to create. Choose the Formula button to open a new panel where you can write the script that modify the outgoing messages.

add new formula modification
Figure 3 - Add new Formula modification

Customize the formula

In the Modifier details panel, you can customize the script that changes your messages. In the example formula, we provided you a script that will make the text of the message upper case. This step requires knowledge of the C# language. To verify if the code is executable, click the Check syntax button. It will run your code and decides whether the syntax is correct or not. It will notify you with a text (Figure 4). Click the Ok button to proceed.

write c# algorithm and check it
Figure 4 - Write C# algorithm and check it

Send your first SMS

To test the modifier, send a test SMS message. Click the New button located on the toolbar. It will open the new message composer. In the Message textbox, provide the body of the message. In this example, we are sending the Hello World text. Click the Ok button to start the sending procedure.

send test sms message
Figure 5 - Send test SMS message

Check the result

As the result of the process, all the words will be capital letters in the message. On the events tab of the recipient, you can see that the received message is all capital letters (Figure 6). We sent the message with normal letters, so the modifier made it all capital letters.

message sent modified
Figure 6 - Message sent modified

More information