Automating NPS with the API

Automating NPS with the API
If you want to find out more about NPS then check out my previous blog post How much do your customers love you?

Every Tuesday morning I send out an NPS survey to our previous weeks customers using Usually, this means creating a campaign and uploading a csv of all of your customer emails.

Recently built a REST API, which mean't made sending out your NPS surveys a piece of cake.

To work with the API I built a thin Ruby wrapper to make my life a little easier. Here's how we use it:
Install the gem by including it in your Gemfile:

Create an initializer to setup the promoter api key.

(Log into and click API in the menu to find your API key.)

Make sure you have created a campaign in promoter (with a template that you're happy with), and made a note of its ID.

To find out your campaign id, create a campaign in and check out the url. It should looks something like: The campaign id is the number at the end (after /campaign). At Lexoo we just use the same campaign over and over - just adding to it each week.

You also need to create a contact list for this campaign. Any contact you add to this contact list will work with this campaign. (Make sure it's the contact list that you've created for the campaign you want to upload to.)

Contact list in

Then, I have a simple script that iterates over all of our customers for the previous week - and adds them to the contact list using the Promoter::Contact.create method.

After we've added all that weeks customers, I launch the campaign with the Promoter::Campaign.send_surveys method - and watch the surveys go out!

Note: by setting the second parameter as false, it won't send out the surveys to anyone who's already received one.

Rather than manually doing this on a weekly basis, I have a cron job set this off for me every Wednesday:

And boom - there we have it, automated NPS requests!

You can view all of the source code here: