This post outlines how to quickly implement transactional email using the Sendwithus API.
As an example, we’ll show you how CodeCombat uses our API to keep players and contributors up-to-date and engaged with their service.
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 mode.
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 were set up and 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.
STEP TWO: Retrieve The API Key
Create a free Sendwithus account and retrieve the ‘Production API Key’ from our ‘API Settings’ Tab.
STEP THREE: Implement The Code
Reference the Sendwithus Library and input the API Key
https://gist.github.com/mrmch/92d237c88435bf15fad5
Create an API Call with references to the email templates you’ll be using. You can find the email template API IDs under the ‘My Templates’ tab on the Sendwithus Dashboard.
https://gist.github.com/mrmch/955e2e8082dbbf8d32af
Finally, set up 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.
https://gist.github.com/mrmch/6400f9c926bed147560a
That’s it.
The best part? You can take a look at CodeCombat’s actual commits here and here.