How do you programatically send a text message?

Red Squirrel

[H]F Junkie
Joined
Nov 29, 2009
Messages
9,211
Pretty much as title, how do you go about sending a text message programmatically? I'm not talking about sending an email to a service that does it for you, I want to actually send it directly. I have a land line, if it matters. Not sure if it can be done through a dialup modem or something. Not too sure exactly how SMS works in that respect.

Basically this is for my monitoring system. It sends emails, displays alerts on a "noc view" but I want to add a SMS feature to it too. This is ideal for if the email server is what the alert is for, because well, the email alert wont go through. :D
 

Red Squirrel

[H]F Junkie
Joined
Nov 29, 2009
Messages
9,211
Hmm no way to do it directly without relying on a service? I guess no matter what I'd probably end up having to pay for a cell plan even if I did do it directly right? Basically I want to code the functionality into my app, but I guess I could always just code it to use one of those services and allow user to configure which one. Might also be easier to just add a custom command feature.
 

cyclone3d

[H]F Junkie
Joined
Aug 16, 2004
Messages
15,549
Hmm no way to do it directly without relying on a service? I guess no matter what I'd probably end up having to pay for a cell plan even if I did do it directly right? Basically I want to code the functionality into my app, but I guess I could always just code it to use one of those services and allow user to configure which one. Might also be easier to just add a custom command feature.

Just do what radgoos said and send a text through email.

You can always just use a backup email service if you want to report the email server being down.
 

Red Squirrel

[H]F Junkie
Joined
Nov 29, 2009
Messages
9,211
Text through email does not work with my provider. I was originally going to do that.

But yeah maybe I'll just work on setting up a secondary mail server, probably simpler. I've been wanting to setup a secondary DNS too, so maybe I can just get a cheap VPS somewhere and do backup DNS and backup mail server and kill two birds with one stone.

It's good to know that there are AT commands for SMS though. Something to play around with at work sometime for fun, whether or not I end up using it. I don't actually have a modem at home and I'd probably have to walk through the depths of mordor to even find one these days. :D
 

TCM2

Gawd
Joined
Oct 17, 2013
Messages
572
Of course you need to use a GPRS/UMTS stick, not a traditional landline modem. It's just that they use the same command set and have special commands for sending text messages, which traditional modems lack, obviously.

Edit:

Code:
# tip ucom0
connected
ATI
Manufacturer: huawei
Model: K3765
Revision: 11.126.03.06.00
IMEI: [...]
+GCAP: +CGSM,+DS,+ES

OK

I don't have a spare SIM card for testing, but how hard can it be? Sending some characters via serial. Most simple thing in the world.
 
Last edited:

Red Squirrel

[H]F Junkie
Joined
Nov 29, 2009
Messages
9,211
Ohhh I see. I guess that makes sense. Probably need a cell service associated with the card then? A VPS with backup email server will probably cost less per month than a cell phone plan so guess I'll forget that idea and just stick to email notifications and setup a backup mail server.
 

devman

2[H]4U
Joined
Dec 3, 2005
Messages
2,400
Ohhh I see. I guess that makes sense. Probably need a cell service associated with the card then? A VPS with backup email server will probably cost less per month than a cell phone plan so guess I'll forget that idea and just stick to email notifications and setup a backup mail server.

You can get some very cheap prepaid cell plans, particularly if you don't intend on using it much. Check out some AT&T or TMobile MVNOs

That being said, Twilio's pricing (linked by someone else above) will be tough to beat even with a DIY solution and a cheap prepaid account. ($1/mo for a number + $0.0075 per message sent or received)
 
Last edited:

Red Squirrel

[H]F Junkie
Joined
Nov 29, 2009
Messages
9,211
Yeah Twillo sounds interesting, if I don't setup a backup email server that may be very well worth checking out. It sounds fun to set up a "text client" myself at home but price wise it probably just makes more sense to use that service.
 

CEpeep

Supreme [H]ardness
Joined
Oct 23, 2004
Messages
6,061
Why not just use something like Google Voice? It's completely free and can be used to send SMS to any US number. It doesn't have an official API, but there's several 3rd party scripts that can be used to automate calls and texts.
 

TCM2

Gawd
Joined
Oct 17, 2013
Messages
572
I was under the impression that the monitoring is for when you're actually away from home.

I don't see how it makes any sense to use a third party service that depends on _your_ side of the connection being up and _their_ side of the connection being up, to monitor your end of the connection.

Monitoring should go via a different channel than what you're actually monitoring. Or so I thought.
 

Red Squirrel

[H]F Junkie
Joined
Nov 29, 2009
Messages
9,211
It would mostly be for when I am away, since when I'm home I typically leave the "NOC view" up and the alert will popup there, but if I'm say at work and not VPNed in or looking at the view I wont get the email if the email server happens to go down. If my internet goes down and I'm not home I kind of lose monitoring either way but at some point I'll probably code a slave monitoring server functionality into my app. No matter what server I put the monitoring on, that's always going to be a potential issue till I code that functionality in.

The more I think of it I think just getting a cheap VPS with backup email and backup DNS is my best bet, since I do want to setup a backup DNS anyway, so may as well just do both. Eventually can use that as the slave monitoring server as well. I'll still eventually implement SMS so I'll probably look at one of those services. It's too bad those email SMS servers don't work for my provider because that would be the easiest to implement, I'd just add that email in the list of emails to send alerts to. I'd have to contact my provider's support on that, because they DO have an email address published so maybe I'm just doing it wrong, could be I have to put something special in the subject line or something along those lines.
 
Top