Convert Tweets to Emails with Google AppsScript

Tomas Vitvar
Oct. 01 2010, 01:00PM EDT

People and organizations start using Twitter today for general public announcements or as a primary communication channel in closed communities. For example, I use Twitter when I want to share a story with my students or announce a newly available studying material. But what do you do if there are some people who do not want to use Twitter and still rely on email communication? By using Twitter API and Google AppsScript you can write and run a simple mashup that sends an email anytime you post a new message on Twitter.

Google AppsScript is a JavaScript cloud scripting language that allows you to automate tasks across Google products and third party services. You can use Google AppsScript to write custom functions and utilize interfaces for Google core services such as email, Calendar, Contacts, or Maps. You can call any RESTful or SOAP Web API, parse JSON and XML data, process that data and populate a spreadsheet with results. You can then use your function directly in a spreadsheet or configure a trigger that runs your function at specified time intervals.

Twitter2Email

To convert tweets to emails using AppsScript I set up a Google spreadsheet and wrote a mashup that fetches tweets from Twitter via Twitter API, checks whether a tweet has not already been emailed, sends the tweet via AppsScript email service and "remembers" the tweet so that it cannot be sent again next time the mashup is run. If you use the mashup on your own, you can control its operation by a number of parameters. You can specify a Twitter account you want to fetch tweets from, a comma separated list of email addresses, emails' subject, and a creation date of the first tweet you want to start sending emails. In addition, you can control a maximum number of emails that the mashup should send per a single run.

Although you may use third-party services or scripts to convert tweets to email, the solution based on Google AppsScript has several advantages. If you know JavaScript you also know Google AppsScript while having the full control over the functionality you develop. You do not need any server or third-party tools to run your mashup, and you can easily control when and how often it should run.

Want to use the Twitter to email mashup on your own? Just make a copy of the Google spreadsheet, specify your input parameters on the first sheet and configure a trigger in the Google AppsScript editor. Feel free to make any modifications if you have specific requirements.

Tomas Vitvar

Comments

Comments(6)

Where do we get the code from? I now have the spreadsheet what about the app script? can you please put that up somewhere

[...] فروردین Û±Û³, Û±Û³Û¹Û°   سعید قنبری   No comments I recently wrote an AppsScript that sends an e-mail every time a new tweet is posted on a specified Twitter account and encouraged you to copy it and use it on your own. I run it in Google Spreadsheets every 5 [...]