- 2022
- Oct
- 11
StatusNet: Sending email instead of SMS with a new post?
What are you talking about?
If you’ve been around for a while, you’ll remember the birth of Twitter and the open-source clones that came out shortly after. While those clones are still useful, the Internet has become weaponized and services that worked because we had more trust now no longer work as intended.
This article is about StatusNet and it’s ability to send a SMS whenever someone posts a status to a timeline you follow. It uses the email gateway provided by most carriers to deliver a message to you - that is, it simply sends an email to “yourphonenumber@yourphonecompany.com.” In theory, anyway. These gateways now have a very suspicious eye when receiving messages containing links or other words that hurt the carrier’s feelings. They’re all but useless these days, and part of that is due to the ease at which spam can be delivered to your phone.
StatusNet in itself still does the same thing it did back when the last releases were made. We’re still using it for this reason, and because it’s visually more appealing than the lotsawhitespace Gnu Social that followed. It’s probably not something that you should expose to the outside world unless it’s on a low value server, however, as it is over 10 years old.
Yeah, so?
As mentioned, StatusNet can send an SMS any time your timeline is poked. However, this is just an email. Why not modify that so instead of sending an SMS instantly after a status is posted, it sends you an email instead?
That’s perfectly doable, and it’s all but transparent to the StatusNet instance.
This involves poking around in and editing your StatusNet database. In particular, we’re interested in the sms_carrier table. I’m using phpmyadmin because it’s easy to make these changes, but you’re free to use what tool you like. I assume you installed the instance yourself - if not, this may not make sense to you. I’m not going to talk about how and where databases and other files are in this post - if you’re not sure where those are then this isn’t going to be of any use to you.
Open your database by selecting whatever you called it, then navigate to the sms_carrier table. We’re going to make two changes for each of the entries we want to add to our instance. Pick the row you want to edit, and click “Edit.” You’ll be on the screen with all of the things you can change about this entry. (You can also do inline edit, but I like to bring up the full edit screen.)
There are two ways you can do this. Either put a complete email address in as an entry, or use the built-in variable and patterns to allow multiple users with the same domain to enter addresses.
If you want to simply add a complete email address:
The first thing we want to do is give it a useful name: In the “name” field, under the “Value” column (last one) delete what’s there and type something that is meaningful to you. Next, in “email_pattern,” delete what’s in the “Value” column and type your complete email address. Do not modify any other value or function. When you’re happy with the changes, hit “Go” to save it. The StatusNet code will happily ignore the “number” you gave it and send to the email address provided. If something was messed up, hit the “Reset” button.
If you’re running a multi-user instance, I don’t suggest doing this. Any person using the instance can select your email. They can’t verify it because they don’t have access to it, but they can still select it and try to attach it to their account. A better method is to use the patterns provided by the original programming.
If you want to use the patterns:
You still want to give it a useful name, and for this example we’ll use “gmail.” Delete what’s in the “name” field under the “Value” column and type “gmail.” In the “email_pattern” field, we need to make sure we give it the proper information. You’ll see something like “%s@phonecompany.com” - replace the “phonecompany.com” with “gmail.com” - you should have “%s@gmail.com.” This will allow StatusNet to fill in the “number” you give it later. Hit “Go” and save your changes, or “Reset” to clear and start over.
With both of these methods, make sure all of your changes are fully saved, and exit the tool you are using. Now we’ll go to the StatusNet instance in question and log in.
How do I get that email?
When you are logged in, click Connect at the top. You’ll get a screen showing your connected applications, of which you probably don’t have any. There will be two options to the side, SMS and Connections. Click SMS.
You have two options here, depending on how you set up your database changes:
You added a complete address.
pick the name you gave the address in the “Mobile Carrier” dropdown menu, type anything you want in the “SMS phone number” box (it doesn’t care because we deleted that variable) and hit “Add.” It will process for a bit, then you’ll end up at the screen asking for your confirmation code.
You added a domain only.
In this case, chose the domain you want in the “Mobile Carrier” dropdown menu and type the username portion of your address in the “SMS phone number” box. For example, if your address is “mygmailaddress@gmail.com,” pick “gmail” (assuming you called it that,) and type “mygmailaddress” in the phone number box. Hit add, and you’ll end up at the screen asking for your confirmation code.
If you did everything correctly, you’ll have an email waiting for you with a confirmation code in it. Paste that in the box, hit “Confirm,” and you’re done. Now you can go back to Connect > SMS and select the “Send me notices” checkbox under “SMS Preferences” to receive a notification every time someone posts to you or on your timeline.
If you don’t receive an email, check that your spam filter hasn’t trapped it due to the name or sender. It’s kind of unusual to get an email for an SMS confirmation, so mail systems may say “No.”
Both of these steps assume you have an email sender set up on your machine, it’s configured properly, the relay or service you’re using is configured properly, and your receiving email isn’t overly aggressive about looking for spam. If not, this isn’t going to work (obviously!)
It works?
So now, whenever someone posts a message that is on a timeline you’re following, you should get an email notification.
It works! There’s still a chance that your email provider can trap the message as spam, especially if there are links that look spammy. Whitelist the email these are being sent from, and you shouldn’t have any problems.
StatusNet itself is getting pretty old, and there aren’t many instances left out there. If you’re like me, and have a couple of internal systems under your control, this can restore some of the functionality lost over the past 10 years.
This is part 1 of a 2 part series about bringing StatusNet a little bit into the modern era. The next and final article will be about removing some of the identifying information to provide a little less of an attack surface should someone happen to run across your instance.
Now tell the little blue bird to get lost. We have some statuses to post!