Guest Post: Building Your Own Gmail in a Day with Temboo & SendGrid


Posted on

This guest post comes from Marianne Bellotti, Hacker-in-Residence and Developer Evangelist at Temboo. She is a veteran of the hackathon scene, data junkie and completely self-taught programmer, she loves nothing more than mashing up some good APIs.  You can find her on twitter at @bellmar.

It used to be if you wanted to break free from the infrastructure rolled out for you by big internet businesses, you had to spend hours maintaining your own servers, selecting and configuring software options, and writing hundreds of lines of uninteresting code to get even the most basic level of functionality. Now with cloud environments and APIs available for nearly every type of feature you can imagine, it is possible to build hacks that allow you to privately manage your data the way you please. Store it where you want, have it displayed where you want, build in the integrations that you think are useful.

Building a custom Gmail, for example, is a simple matter of using Sendgrid‘s API with Temboo. Temboo has a stable of SDKs that allow developers to build and execute component code in a cloud environment. What does that mean? Rather than having libraries filled with code that needs to be maintained and updated for each application every time there’s a change, applications have a directory that maps to where each process lives in the cloud. If the process needs to change for whatever reason, you need only change the code in the cloud. All the applications that rely on that process instantly update themselves. No out-of-date libraries. Things keep working without you doing anything.

All this provides an excellent infrastructure for web development. Because the SDK is just a directory that helps applications connect to our processes (called Choreos), a process designed to run in a Java application can also be run by a Python script. Code becomes truly language agnostic. Developers can share algorithms without having to port them over. What a truly wonderful way to hack.

And Temboo has Sendgrid support out of the box, which gives any app instant email capabilities. I’ve been a Sendgrid fan from day one because there’s nothing really more obnoxious than setting up a mail server just so your website can send little ‘validate your email’ messages and help people reset their passwords, but when we were reviewing Sendgrid’s API for inclusion in our default library, I noticed the Parse APIHoly cow, my apps can receive mail too? This seemed too cool not to play around with.

So I sat down, whipped out my Temboo account and in a day built a simple webmail client that allows me to drag and drop files from Dropbox into my email, without opening Dropbox, without even logging into Dropbox.

Sendgrid + Temboo

With any other company, I might have expected a thousand and one configuration instructions to get my app to receive email. But no, it was just as easy as getting my app to send email in the first place: buy a domain, change the MX Record, tell Sendgrid what URL to direct the data to and voila! My emails come through as POST variables, easy to capture and use.

The rest is all Temboo. Sendgrid is pretty simple, especially if you take advantage of their sample code and libraries. But the advantage that Temboo offers over a single API specific library is that request procedures are streamlined over all services. REST? SOAP? XML-RPC? It does not matter. Every single API request is handled with the same, clean, simple lines of code. To send email with Sendgrid, I need only do this:

To access my Dropbox account, the process is exactly the same.

 

What’s This Set Credential Business?

When you use an API, you usually need some kind of key right? Either a seemingly random string of letters and numbers or– as with Sendgrid– your login information. There’s nothing more nerve wrecking than putting passwords and account information in your source code, but in most situations you don’t have much of a choice.

Except with Temboo you can store your credentials securely on our servers and instruct the process you’re using to fetch them before it runs. What’s more, if you need to change your credentials for any reason there’s no more editing and updating every single hack that uses them. You just log back into Temboo and edit them there, all your Temboo powered applications will continue working.

This was particularly useful in building the demo because I started off using my own personal Sendgrid account but then I realized that no matter what I do this demo will attract spam. I use my Sendgrid account for lots of other things, better move the demo off to a dummy account so that if it has to be killed for abuse it doesn’t affect anything else.

Stored credentials is also how I’m able to access my Dropbox account without logging in. If the service you want to use requires OAuth authentication, you can generate the tokens straight on Temboo.com and store them for your use.

No need to choose between accounts either. You can add multiple credentials for the same service if you like. Give them unique names you’re all set to run. Credentials are encrypted using the same security procedures used by banks to protect your data.

The Demo, The APIs, The Spam

So what does our demo Tmailroom.com do? It receives email sent to demo@tmailroom.com, it allows you to read, reply, and delete that mail. Then below the mail client it displays the contents of a special Dropbox account I set up for it.

Yes, that’s a live account. I would have programmed the ability to upload things to it but I wasn’t sure people would use that power for good.

Now as I write an email to my friend instead of attaching a file, I can drop a link to it just by dragging and dropping the file into the email body. Easy, but only the tip of the iceberg with what I could have done had I been building something that was not going to be instantly trolled by spammers from all over the world. I could have it actually attach the real file. It could automatically upload any attachments I receive to Google Drive, or just about any other file sharing or document management system. I can have it connect to LinkedIn and automatically look up the profiles of the companies that email me. I can even have it pull in and interact with my Gmail and apply whatever functionality I decide on to my Google account.

Still using Sendgrid, I was able to give this demo the ability to detect abuse. It accesses my Sendgrid statistics and monitors how close to my limit of 200 emails a day I am and tracks the number of spam reports issued against me. When either of those numbers get above a certain point, it turns the email sending features off automatically.

In order to protect people’s privacy I had the demo scramble email addresses before displaying them, and I decided not to let replies go through just in case. But if this was a real hack obviously neither of those measures would be necessary.

The Future Will Be Hacked

Everyday at the Temboo offices we review APIs that do fun, interesting, ridiculous things. Once the data is out there, it’s free to use if only developers can access it. The harder we work, the easier it gets to build products that in the past whole startup teams have been needed to produce. Want to build your own Dispatch? Your own About.me? Your own RightScale? The APIs are out there, and Temboo gives you the power to use them.


Swift is a developer evangelist at SendGrid who is based out of NYC. He is one of the founders of Hacker League and tweets as @SwiftAlphaOne. Follow him there and check him out at http://theycallmeswift.com.

One thought on “Guest Post: Building Your Own Gmail in a Day with Temboo & SendGrid

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>