Birthday greeting SMS service with SQL Express
This page provides information on how to setup Ozeki NG - SMS Gateway, if you wish to send, for instance, to your employees, birthday wish SMS messages with the use of Microsoft SQL Express database server.
It is recommended to get familiar first with how you can send messages by using SQL Express. Concerning this, you can find information at the SMS messaging with SQL Express page.
To set up the birthday SMS service, we assume that a working SMS service provider connection is already configured in your Ozeki NG - SMS Gateway, and a database user is also setup. The database user is connected to the SQL Express database.
You can see the system architecture of the birthday SMS service in Figure 1. Here you can see how the system works in this case. First, Ozeki NG applies a query (1) to the database table regarding the people who have their birthday the current day and have not yet received a birthday SMS message. The database then submits this information to Ozeki NG (2). The software sends the birthday message to the SMSC (3), from which the people having their birthday receive the birthday SMS message (4) to their mobile phones.
To have the birthday SMS message service, first you need to have a database containing the birthday information. This table is referred to as birthday table in the following sections. The table definition should be as follows:
CREATE TABLE birthday ( id int identity(1,1), customername varchar(100), customerphone varchar(30), birthdate datetime, lastnotified datetime, status varchar(30) );
After the birthday table has been defined, we create it in the database server using an SQL command shell.
Put some test data into this database table you have just created.
INSERT INTO birthday (customername,customerphone,birthdate) VALUES ('Elisabeth','+3620111111','1980-01-01'); INSERT INTO birthday (customername,customerphone,birthdate) VALUES ('Mark','+3620222222','1982-04-29');
After this, you need to configure Ozeki NG - SM Gateway to send birthday reminder messages based on the information that our database contains. For this, you should adjust the commands in the configuration form of the database user.
The first command is used to pick up messages. Click on the SQL for sending tab of the configuration form of the database user. Modify the SELECT statement as follows:
SELECT id,'',customerphone,'Happy birthday' from birthday where datepart(month,getdate())=datepart(month,birthdate) and datepart(day,getdate())=datepart(day,birthdate) and (convert(varchar(10),getdate(),111)>convert(varchar(10),lastnotified,111) or (lastnotified is null));
The second command is used to update the 'lastnotified' information in the birthday database table. Click on the tab of the Sending statement and modify the statement:
UPDATE birthday SET lastnotified=getdate() WHERE id=2
This update will make sure that the birthday reminder is sent out once only.
Finally, the other SQL commands should also be modified to work with the birthday table. Click on the Sent tab, and modify it as follows:
UPDATE birthday SET status='sent' WHERE id='$id'
And you should also modify the other commands the way described above (Not sent, Delivered, Undelivered).
To test if you have set up the service properly, you can send a birthday message if you set the date to the birthday of one of the persons in our example. Let us choose Mark. After setting the date of the computer, on which you are running Ozeki NG - SMS Gateway, to 2020-04-29, you can see in the databse user's Events window that the message was found in the database, and it was accepted for delivery. If you look into the database table, you will see that the "lastnotified" field was updated.
- Examples and SMS solutions
- SMS Reminder example
- SMS newsgroup
- SMS Forwarding
- Ozeki Phone Sytem PBX SMS
- SMS order System
- SMS Menu
- Google maps SMS
- Distributed SMS
- Birthday greeting SMS service MySQL
- Birthday greeting SMS service Oracle
- Birthday greeting SMS service SQL Express
- Feature list of the Ozeki NG SMS Gateway
- FAQ of the Ozeki NG SMS Gateway