How to schedule SMS messages for sending

If you use the SQL-SMS gateway configuration of Ozeki NG SMS Gateway, you can schedule your SMS message sendings in a very simple way. Scheduling means that you set a specific date and time for a message to determine when should it be sent.

Setup scheduled SMS sending (table layout)

To configure this option, first you need to modify your ozekimessageout table definition to include an extra column for the scheduled delivery time. You can call this column "scheduledtime". To modify the table definition issue the following SQL command in an SQL console:

alter table ozekimessageout add column scheduledtime

MySQL:
ALTER TABLE `ozekimessageout` ADD `scheduledtime` DATETIME NULL AFTER `errormsg`;

Setup scheduled SMS sending (configure Ozeki NG)

After the table layout has been modified, you need to open the database user configuration of Ozeki NG. The configuration modification is simple: you need to modify the SQL query used for selecting messages to be sent (Figure 1). This can be done by clicking on the "SQL for Sending" tab of the SQL user configuration form and changing the "Polling" query to this:

SELECT
   id,sender,receiver,msg,msgtype,operator
FROM
   ozekimessageout
WHERE
   status='send' and scheduledtime<now()

Notice the added where condition that will only select messages that can be sent from the database.

Figure 1 - How to configure scheduled SMS sending

After this is configured, to send a scheduled SMS message all you have to do is specify the datetime value in the ozekimessagout table.

More information