How to set dynamic keywords in Ozeki NG SMS Gateway

This page explains how you can set dynamic keywords in Ozeki NG SMS Gateway effectively. The example below uses Oracle 10g XE database for demonstration.

When you use Ozeki NG SMS Gateway you can set keywords in the SQL table to achieve various functions. For the list of the available keywords please check Keywords in the SQL templates page.

However, there is a possibility to define further keywords beside the above-mentioned ones to get further functions. These dynamic keywords can be specified in your database (in this example in Oracle 10g XE database). After you specified your keywords, Ozeki NG SMS Gateway will poll the variable names and parameters from the database.

Since this example uses Oracle 10g XE database for demonstration, it is required that the Oracle database has been configured to Ozeki NG according to the following webpage: https://ozekisms.com/p_2646-send-sms-from-oracle-database.html.

Step by step guide

First you need to create the necessary database tables and structures. Insert the following SQL commands and click on Run:

Create table dynamicvariables and click Run (Figure 1):

CREATE TABLE dynamicvariables ( 
  id int, 
  varname varchar(30) default NULL, 
  varvalue varchar(30) default NULL
)

sql command for creating dynamicvariables table
Figure 1 - SQL command for creating dynamicvariables table

Create index on dynamicvariables and click Run (Figure 2):

CREATE index index_id3 ON dynamicvariables(id)

create index
Figure 2 - Create index

Create sequence and click Run Figure 3):

CREATE SEQUENCE Z

Figure 3 - Create sequence

Create trigger and click Run (Figure 4):

CREATE TRIGGER dynamicvariables_auto BEFORE INSERT on dynamicvariables 
for each row 
when (new.id is null) 
begin 
   SELECT z.nextval INTO :new.id FROM DUAL; 
end

Figure 4 - Create trigger

Now I insert a test variable (AMOUNT) (Figure 5):

INSERT INTO dynamicvariables(varname, varvalue) VALUES ('AMOUNT','1560')

Now I insert a test variable (CURRENCY) (Figure 6):

INSERT INTO dynamicvariables(varname, varvalue) VALUES ('CURRENCY','€')

Figure 6 - Test variable

Now start Ozeki NG SMS Gateway. Go to the configuration panel of the database user and click SQL for Sending tab (Figure 7). On Polling tab enter the following SQL statement for polling messages:

SELECT id,sender,receiver,replace(replace( msg, 'AMOUNT', (select varvalue 
from dynamicvariables where varname='AMOUNT')), 'CURRENCY', (select varvalue 
from dynamicvariables where varname='CURRENCY')),msgtype,operator FROM 
ozekimessageout WHERE status='send'

Figure 7 - Polling tab

Then insert a test parameter in the ozekimessageout table in Oracle (Figure 8):

INSERT INTO ozekimessageout (receiver,msg,status) VALUES ('+36205460691','test 
data from amount table: AMOUNT, and test data from currency table: CURRENCY','send');

Figure 8 - Test parameters

Figure 9 demonstrates a sent message in Ozeki NG SMS Gateway that has been sent with this configuration.

Figure 9 - Sent message

For more information, please contact us at info@ozekisms.com.

More information