Over the last few months, something very exciting has been happening at emfluence. For years, our Marketing Platform developers have been slaving away at improving our online Marketing Platform. Recently, they’ve unveiled a feature that promises to multiply their efforts and rapidly increase the potential of the platform. 

What is this awe-inspiringly powerful feature, you ask? It’s an Application Programming Interface, or API! An API is like a lever: It allows people (mostly developers) everywhere to apply a small amount of code to a big tool so that they can achieve big things. If you’re in marketing and you are a web developer – or you know someone who is – then you should read this. So put on your nerd hat and Matrix-style overcoat and settle in. I’m here to tell you what your experience will be like, developing with the API.

I don’t even develop for the platform. I’m a web developer who mostly works on websites for emfluence clients. And that’s precisely why the API is so exciting to me: As a platform "outsider," I can now start spit-balling integration ideas, just like you. 

Leading up to the emfluence Marketing Platform User Conference this year, emfluence hosted a challenge to hack together the best application with the newly minted API (currently in beta). I formed a team with Tyler and Sara and we called ourselves the Australian Bobsled Team (I'm Australian). It was a great opportunity to build something that could have broad appeal and show off what the API really meant for marketers. 

I knew my app needed to have a rich user experience so I devoted my time to working entirely in the front end, with Javascript as the integration language.  My team ended up winning the challenge based on attendee votes (and a fancy rock-paper-scissors tie-breaker).

 

 

So what can you do with the API?

I know for sure that you can build an app that connects to an authorized platform account and analyzes the activity of all email contacts over time to discover the most likely brand advocates. Spoiler alert: I did that! If you’re sending emails through the emfluence platform, contact Sara and she can demo our app – which we called "Champs" or "For the Win" – with your data.

You could build an app that you can sell as a service, or an app that makes your marketing operations more efficient. In fact, emfluence might even start using the API in-house to develop our own series of plugin apps, as we continue to extend the platform. Do you have an idea for something that would work great with the platform? Don’t wait for us to make your idea a reality! Heck, if it’s really good we might even try to buy it from you.

What was it like developing with the platform?

It was really easy. Since emfluence prides itself on on-to-one communication, if you’re developing with the API you you’ll have access to ask a platform pro all of your questions – but let me get you up and running first. My app involved building a Javascript library and it makes your job really easy.

First of all, here’s a very simple way to use the API. It uses the standard jQuery library to make an AJAX call. Huzzah.


jQuery.ajax({
type: ‘post’,
dataType: ‘json’,
contentType: ‘application/json’,
crossDomain: true,
jsonp: false,
url: ‘https://api.emailer.emfluence.com/v0/helper/ping’,
data: JSON.stringify({}),
success: function(result) {
jQuery(‘body’).append( ‘

' + JSON.stringify(result) + '

‘ );
}
});

Look at you, integrating with the API already! Ready to do more than one thing? Now you’re talking. 

Let’s say you want to get a list of emails, a list of the engagement details for each contact, a list of detailed contact records… Suddenly you’re queuing up tens or hundreds of API calls. Like all API’s, emfluence’s has fair use restrictions that stop you from making a barrage of requests all at once. That’s where my library comes in handy.

Instead of getting down and dirty with jQuery, simply pass your parameters to my library along with your callback function and I’ll let you know when your data is ready. I’ll keep a running tally of API calls in queue and you can easily expose that progress in your UI. I’ve built a way for urgent API calls to skip to the front of the queue. I’ve even implemented an optional data caching system so that subsequent page loads get their API data loaded faster. If there’s a problem, pop open the developer’s console in your browser and you’ll see a full log of what happened.

Here's a modified snippet from my app:


// Set the API key (Sara can get one for you)
emfl_set_api_key( … );

// Get a list of emails that have been sent
var params = {
status: ‘sent’, // Just emails that have been sent
rpp: 50 // Limit to 50 emails
};
emfl_enqueue_api(
’emails/search’, // The API endpoint
params, // The parameters passed to the API
email_search_callback_success, // The success callback
null, // An optional complete callback
false, // Whether to bump this call to the front of the queue
false // Whether to bypass caching of the retrieved data
);

// Run through the email list and drill down into each
function email_search_callback_success( response ) {
console.log( ’email_search_callback_success’, response );
if( response.success == 0 ) {
console.error(’email_search_callback_success failed’);
return false;
}

// drill down into metrics for each email
var emails = response.data.records;
for( var i = 0; i < emails.length; i++) { retrieve_key_data_for_email( emails[i] ); } };// etc

Now this library was the result of a 48-hour hackathon, so it could do with some additional extended functionality. For example, what if you’re presenting data to the public and need to keep your API key secret? With a little server-side proxy action on your end and minor modification to my library, you can do that. And my library is fully documented in code blocks so that you can hack me.

As I said, we’re all about one-to-one attention. If you want to use or extend this library, feel free to contact me! I’d love to hear what you build.

You can find the full source code and working hackathon app over at Github. The Marketing Platform’s API reference is also a good place to start.

Happy coding.


 

Let's Get Started