Short message service or SMS is a services provided by cellular providers for communication between cellular devices such as mobile phones. Some will ask, is that still in use o.O? The answer is pretty simple, yes! SMS is still in use.
Not every cellular device has an internet connection for using services such as WhatsApp, or the user don't want it. But the use of SMS is an another story, I want to use it and send it automaticly.
Sending SMS messages automaticly requires access to the cellular networks. A pretty simple method for my goal is using an API from a company that provide SMS services, such as MessageBird. You can buy credits for a certain amount of money and use it to send your messages, fully controlled by your application. The other option is using a mobile phone or dongle to access the network. Cons for the last option is you need some hardware and a SIM.
I opted for the last option. It's much more fun to try create such systems yourself than outsource it. After some online shopping for a dongle (Huawei e220 to be precise) and going to the local shopping mall for a prepaid SIM, I was good to go. The dongle is supported by Linux, the operating system I use, since 2007 and the software needed is also available. I could use AT commands to speak with the modem, but I decided to use the open source program Gammu-smsd. It is a daemon that connects with the "phone" and a backend storage, a database in my case, that can process SMS messages.
With Gammu I have a database with an outbox and an inbox. I put the messages in the outbox and it'll be send to it's destination within a minute or so. same goes for the inbox, if the device receives a message it'll be put in the inbox for further processing.
Economics where in my favor. APIs such as MessageBird cost around 13 cents per message in small quantities and 5.33 cents in large quantities. the network I use is KPN Mobile, the national telecom company here in the Netherlands. I bought a prepaid simcard for this project with default pricing of 16 cents per message. When you register the sim you can change your pricing plan. I went with KPN5 pricing plan which makes sending SMS messages 5 cents. KPN compensates this with a more expensive voice experience, but I don't realy care about that. Also their terms are better then the other networks. My prepaid credit is valid "forever", the only requiremend is that I use it every 6 months once. That means creating a cronjob and send every 3 months a message to my own cellphone will keep it valid.
Long story short, I can now send SMS messages from my server. A usefull application for this is two-step authentication where I sent you a code you need to type in.