All posts by brian

Tweetfave Software and Services


With my Tweetfave project finally launched and starting to get a little bit of usage, I thought I’d summarize some of the key building blocks for this project.

First of all, what does Tweetfave actually do? It periodically checks your Twitter account to look for new tweets you have marked as favorite. If you have any new ones, it sends them to your email inbox. The functionality is very simple, but I’ve found it to be a handy addition to Twitter, turning favorites into a sort of “read it later” bookmarking feature.

Following are some of the software tools and services I used to build Tweetfave:

PHP – for this project I chose PHP because it’s what I’m most proficient in. I’ve got another side project going where I’m learning Ruby on Rails, but for Tweetfave I stuck with the familiar. With PHP’s popularity, everything else I needed was already available as PHP libraries, and it was really easy to set up both my dev and live environments.

Twitter API – learning this API was pretty straightforward, especially with the ease of the PHP library. The trickiest part was setting up the whole OAuth flow with my site’s signup/login flow (and PHP sessions). Originally the code required a read/write access to Twitter accounts, but I later refactored that to use read-only access to minimize the chance of any bugs causing problems for live Twitter accounts. I’ve also switched to the new API version 1.1 without any trouble, and (so far) the application is not running into any rate limit problems.

Twitter PHP Library (by Abraham Williams) – this was the first PHP library to help with Twitter’s OAuth API, and may be the most popular one. It’s very easy to add to a project, and makes calls to Twitter really simple. For example, my main call is getting favorites for an account: $favorites = $twitter->get('favorites/list');. See this discussion for a quick change to support API version 1.1.

Twitter Text PHP Library – the Twitter Text library takes the full text of a tweet and adds hyperlinks and markup for detected identifiers like “@” handles, hyperlinks, and search hashtags. For Tweetfave I use the original tweet text in plain-text emails, and the Twitter Text marked-up version for the HTML email body. The results are pretty decent, making the tweets appear almost the same as on the Twitter website. It also extracts all the links contained in the tweet, making it easy to expand those from short form to their original form.

Mustache Templates & PHP library – Mustache provides a very simple templating language that I use to create all of Tweetfave’s outbound emails. Every email sent has both plain text and rich HTML versions included, and Mustache makes it easy to manage dual templates from the same data source.

Swift Mailer PHP library – creating and sending emails always seems more complicated than it should be. The Swift Mailer library is a straightforward way to ensure your outgoing emails are formatted correctly, especially when you want full control over the email including multipart. Paying attention to the details of email creation also helps prevent the messages from being flagged as spam.

SendGrid † – a very reliable email delivery service that “just works”. Even when I was on the free plan, I made a couple of support requests and had excellent service both times. I really like SendGrid’s reports and “Email Activity” dashboard, both of which make troubleshooting and tracking a breeze. One downside is you don’t get a dedicated IP address for your delivery point unless you’re at the $79/month pricing level. So far my emails seem to avoid being flagged as spam even without the dedicated IP.

Bootstrap – the Tweetfave website consists of only a couple of pages, but I wanted to make sure they worked well on both desktop and mobile browsers, so I used Bootstrap as a starting point. It was pretty easy to learn LESS and tailor the Bootstrap template down to just what I needed. For the next go-round, I need to learn how to customize Bootstrap while still being able to merge updates and improvements.

pair Networks † – I’ve been using them for web hosting for over 10 years for this blog and a few small side projects. I ran Tweetfave here as well during the year-long development. Recently as Tweetfave usage has grown, my cron scripts are a bit too much for my shared webhost account, so I moved them to Digital Ocean. I kept the MySQL backend and website on pair.

Digital Ocean – after I outgrew my shared webhost, I signed up for a basic VPS ($5/mo) from Digital Ocean. Signing up and creating my virst VPS (a “droplet” in their terminology”) only took about 15 minutes. Installing my code and packages like PHP only took about a half hour. Very impressed so far.

† Affiliate link; I’ll earn a small referral fee if you use this link; thanks for supporting this service!

I’m happy to answer any questions about the software and services used to build Tweetfave. Just shoot me an email (brian at cantoni dot org).

If you haven’t tried Tweetfave yet, give it a shot.

Image credit: zzpza (Flickr)

Introducing Tweetfave

Tweetfave logo

Tweetfave is a free service to help you get more out of Twitter favorites. Tweetfave monitors your Twitter feed and sends the tweets you mark as favorite to your inbox.

I built Tweetfave for myself (“scratching my own itch”) and it’s really helped me track and remember interesting tweets and links. It’s especially useful when reading my Twitter feed on a mobile phone. If I don’t have the time (or patience) to read linked articles on the phone, I’ll mark the tweet as a favorite, knowing it will arrive later in my inbox.

Give Tweetfave a try and let me know if you find it useful, and whether it changes any of your Twitter favoriting behavior. (In my case I have favorited over 5000 tweets since I started working on this project. I’ll save the details for another post…)

Screenshot of sample Tweetfave email

Tweetfave sends the tweets you marked as favorite to your inbox

Domain Names and Web Hosting by Pair Networks

For the past 10+ years I have hosted this website and my other side projects through pair Networks. I’m also managing all of my domain names through the sister company pairNIC.

As of today (2 more domains registered!) I have 17 domain names, 7 of which have live websites. The rest are on my “todo” project list.

I’ve been very happy with pair, both on price and support.

If you have a need for either web hosting or domain name registration, you should consider pair. If you use these links I’ll get a small referral which helps pay the bills.

Export Twitter Friends Script

As part of my Tweetfave project, I wanted to get a better sense of the people I’m following and whether they use the Twitter “favorites” feature. By using the Twitter API, I’m able to first fetch my list of friends (i.e. people I am following), then get the detailed stats for each one. The result is a CSV file which can imported into Excel or other spreadsheet program:

Screenshot of Twitter friends in Excel

Twitter friend data loaded in Excel

This script is written in PHP and uses the Twitter OAuth PHP library. It uses the Twitter API methods friends/ids and users/lookup. Because the user lookup can handle up to 100 friends at a time, these APIs are quite efficient.

This script is available on GitHub (bcantoni/5457114), and embedded below. Follow the installation steps if you want to try it yourself.

Update: There is also a version of this script for exporting followers.

Preventing Scam or Fraud Warnings for Email Newsletters

Some email clients like Thunderbird will sometimes show a scam warning message on emails which appear to be normal and not suspicious. The Thunderbird warning is two-part: first an inline message “This message may be a scam, and second a modal dialog which appears when you click on any link in the email. Combined this could be worrisome for users who aren’t sure what the warning means.

I’ve been seeing this more frequently lately with email newsletters. The most common cause is link tracking added by the newsletter delivery vendor (MailChimp, Tinyletter, etc.). The scam warning will come up whenever the displayed text link does not match the embedded hyperlink. It’s mean to detect phishing attacks where the displayed text may say “”, but the link actually goes to “”.

For example, this link will cause the warning:

<p>Visit our home page: <a href=""></a></p>

Instead the problem can be avoided by using text instead of a URL for the link:

<p>Visit our <a href="">home page</a></p>

Here’s an example of Thunderbird complaining about a few links in Scott Hanselman’s Newsletter of Wonderful Things. (By the way I don’t mean to pick on this excellent newsletter, just using it as an example.)

Thunderbird screenshot showing scam warning message

An example of the Email Scam warning message in the Thunderbird email client

To learn more, I recommend these two resources which explain the Thunderbird behavior and how to prevent it for most cases: