This is a retrospective on one of the first pieces of software I wrote for myself.

I used to post to Twitter to advertise articles I wrote on Blogger. (I stopped doing this when Twitter changed its algorithm to punish users who shared outside links.) I used to do it manually, by copy/pasting the link and then writing a short blurb. I didn't like doing this, though, because it meant the same day, I had to come up with a blurb for the post, which was annoying. I would also sometimes forget to do so.

I've always been aware of the power of social media to help spread posts and build a following and all that, but I don't love using social media. For one, you have to be logged into the correct account. Sometimes I forget my password and then I get discouraged and don't post anything. You have to switch between the different networks and post the same thing, but slightly modified for each network. This means it is mindless, but not mindless enough to plow through it like an automaton. Finally, timing is a big deal. I had to make these posts when my actual blog post was published. On Blogger I could schedule my posts so I wouldn't have to worry about it, but then I had to go and Tweet and Facebook and Instagram and Tumblr after my post was published. I never liked much of that.

I tried to automate the posting of new post alerts on social networks. I looked into ifttt, but it didn't give me the fine-grained control I needed when making the actual social media posts. It basically just posted a link to the article. That's not what I was looking for - making your own description tailored to each network instead of robotically posting a snippet of your first paragraph makes a difference. I eventually used a free social media manager (Hootsuite) that had post queueing, but it limited the number of accounts you could have and posts you could make on the free tier. It was an okay solution. But it wasn't as automatic as I would have liked.

I was mostly trying to be active on Twitter since there was a lot of discussion happening there. Facebook is more "walled-garden," which limits the amount of discussion that can happen naturally. Instagram isn't really a discussion forum at all, and my blog wasn't a picture-heavy site. Tumblr is really questionable in terms of promoting posts. So of all the social networks I'm on, Twitter is the best suited for actually communicating with people.

I still want to update all those other social media networks when a new post comes out. I can use Hootsuite, but then I have to navigate their whole interface and queue the posts and I... don't really like doing it. Is there anything else that can be done?

I found out that there is a Blogger API that lets you create Blogger posts. This gave me the idea of making an app that reads Blogger posts for something like that comment I put earlier, and then makes the appropriate posts for social media accordingly. I could insert a snippet like this:

        <`!-- start social media
        Twitter: Check out my cool post! mylink.com
        Facebook: Check out my cool post! I spent a long time working on this! mylink.com
        Instagram: [myurl] Check out my cool post! mylink.com #topic
        Tumblr: [text] Check out my cool post! I spent a long time working on this! mylink.com [tags] topic, post
         --`>
        

Ultimately, what I wanted was a bot that would fire when a new post was made to blogger. It would scan the post for a trigger phrase and based on that, fire off a Tweet. I got to work on it, and did in fact make one.

Some problems I ran into while doing this:

Getting access tokens for Blogger was less intuitive than I thought it would be.

Getting access tokens for Twitter took several days where I had to tell them more than once that the only thing my "app" was doing was posting to my own Twitter account and no, I was not looking at anyone else's Twitter posts.

I have been trying to extend the functionality to Facebook as well, but their whole approval process is even more tedious than Twitter's (fun fact: you need an image for your app! With exactly certain dimensions!). Instagram didn't seem to be letting anyone other than specially-invited business accounts post using the API. Tumblr seems to be the easiest to implement, but I didn't know if I wanted to keep advertising through Tumblr.

I wrote it in Javascript for reasons I don't really remember, and I hosted the bot on Heroku's free tier (RIP). The bot checked Blogger every 5 hours. It kept a list of the latest blog post. If the next time it fetched a blog post, the id changed, it would look through the body of the post to find a special value: [!TWITTER!]. This magic value was used to delimit the text that would be sent to Twitter. It was highly unlikely I would ever use this text any other way, after all. I could use other magic strings for Facebook, though I'm not sure I ever got that functionality working. The bot worked quite well while it was functional.

A few things consigned this bot to the dustbin of history. One is that Twitter algorithm change to penalize people who shared links. Obviously one of the reasons I wanted to use Twitter was to promote my site, so if promoting it got it less visibility, why bother? The other is that Heroku shut down its free tier. There was no point paying for a bot to promote to a social media site that would punish me for sharing a link. Other social media sites were also pretty pointless to advertise on. As such, I stopped promoting my posts on social media entirely.

Were there potential issues with the bot? Yes. I'll start by saying that the code was not as clean as it could have been! And that's an understatement! The variable names were not clear. There were things commented out that probably should have been removed. I appreciate that I left comments explaining what each thing did. Overall, the readability leaves much to be desired.

There's also security concerns. The obvious one is if someone could hijack my blog, they could take advantage of this feature to post things to my Twitter account. Now, so long as they did not have access to my Twitter account, I could simply shut off that API key and revoke permissions to the bot.

The more concerning ones are that I don't sanitize content in the code.

Overall, this was a questionably made but undoubtedly useful little program that saved me the menace of having to interact on Twitter. It gave me just the amount of flexibility I needed without needing to shell out for something like Hootsuite. It's very awkward now, but I look at it fondly as one of the first times I made a tool for myself.