How To: Implement Transactional Email in 1 Hour or Less

This post outlines how to quickly implement transactional email using the Sendwithus API.

As an example, we show how CodeCombat uses our API to keep their players and contributors updated and engaged with their service. Take a look below for a line by line guide on their implimentation.

But first, some background.

Our YC buddies at CodeCombat build a free browser game that teaches players to program while playing an RPG. Players live-code JavaScript to explore dungeons, defeat enemies, and battle other users in muti-player.

Earlier this year, the team open sourced the product, so that users could create their own content. Today, they have 155 contributors on Github, and over a 1000 people using their level editor to add to the game.

“Transactional emails are important to keep people engaged, both when playing on and contributing to CodeCombat. And, it took just about no time to set up the Sendwithus API.”

– Scott Erickson, Co-Founder CodeCombat

By implementing our API, CodeCombat is able to engage players with new challenges, and update contributors on changes to their documents.

They got setup and started sending email in under an hour – here’s how they did it.

STEP ONE: Install The Sendwithus API Client

Our open source clients can be found on the Sendwithus Development Page. API’s are available in Ruby, Python, Node.js, PHP, Java, and cURL.

API Client

STEP TWO: Retrieve The API Key

Create a free Sendwithus account and retrieve the ‘Production API Key’ from our ‘API Settings’ Tab.

SWU Dashboard API Key

STEP THREE:  Implement The Code

Reference the Sendwithus Library and input the API Key

Create an API Call with references to the email templates you’ll be using. You can find the email template API ID’s under the ‘My Templates’ tab on the Sendwithus Dashboard.

Finally, setup a function that triggers an API call. In this case, CodeCombat sends an email if a change is made to a document a contributor is watching.

That’s it.

The best part? You can take a look at CodeCombat’s actual commit’s here and here. 

Share this post
Tweet about this on TwitterShare on Facebook

Leave a Reply

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