Introduction
Welcome to the Promoter API! You can use our API to access endpoints, which can get information on various contacts, feedback, and campaign metrics in our database.
We have a robust API to provide tons of options for all needs, but the most popular use is triggering to send surveys, found in the Contacts section below.
API Rate Limiting
Based on your plan, you will be allowed an API request rate of X requests per minute. Your limit can be found by visiting the "API" section of your account.
When the requests per minute exceed the allotment, you will receive the following:
A response status code of: 429 (Too many Requests)
A response body of:
{ "detail": "Request was throttled. Expected available in 42.0 seconds."}
A response header to inform of the client when in time you can retry the call:
- Retry-After: 42
- Retry-After header value will be in <delay-seconds>
- For more information see:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
Authentication
Promoter uses API keys to allow access to the API. You can register for a Promoter Account and access the API key in your main account settings under 'API'. Promoter expects for the API key to be included in all API requests to the server in a header that looks like the following: Authorization: Token YOUR_API_KEY
. The key should be prefixed by the string literal "Token", with whitespace separating the two strings.
With curl, you can pass the correct header with each request curl "https://app.promoter.io/api"
.
Error Codes
403
Forbidden
The resource requested is hidden for administrators only
404
Not Found
The specified resource could not be found
405
Method Not Allowed
You tried to access a resource with an invalid method
406
Not Acceptable
You requested a format that isn’t json
410
Gone
The resource requested has been removed from our servers
429
Too Many Requests
You’re requesting too much! Slow down!
500
Internal Server Error
We had a problem with our server. Try again later.
503
Service Unavailable
We’re temporarily offline for maintenance. Please try again later.
Survey a contact
- Before surveying contacts via the API, you'll need to first create a campaign in your account.
- Once the campaign is created, you'll visit the API settings in the "Integrations" section.
- Click to '+ Add Integration' and choose your campaign.
- Choose the delivery settings you prefer for surveys being triggered with the API.
When surveying contacts, you can pass in as many attributes as you’d like along with them. These can be useful when filtering your NPS on the campaign dashboard. The minimum requirements for surveying a contact are the contact’s email and the campaign id to survey them from.
- Depending on your Survey Throttle setting, your contact may not be surveyed if they have been recently surveyed. (Survey Throttle setting can be found in your account settings.)
24 Hour Survey Throttle
Our system has a 24 hour throttle built in so any contact cannot be surveyed more than once in a 24 hour period. Due to this, you may need to use aliases of your email while testing.
Ex: joe+1@mac.com, joe+2@mac.com...
If you would like this temporarily disabled while testing, please write in to support@promoter.io.
Update a Contact
You can add as many attributes as you’d like along with your contact. These can be useful when analyzing NPS data on the campaign dashboard and using the 'Filter Segments' option.
The parameter required when adding a contact is the contact’s email. If you don’t specify a contact list for the contact to be added to, a default list with the name "Default List for (Org Name)" will be automatically created for you, and then the contact will be added to this list.
When updating a contact's info, a contact list does not need to be specified.
This action only adds a contact to a list and does not send them a survey.
Unsubscribe a contact and cancel surveys
Within our platform, you can unsubscribe a contact and this will prevent the ability to survey them in the future. The unsubscribe action will also cancel all future pending surveys that were scheduled for that contact.
Get contacts
This endpoint retrieves all contacts in your organization. You can also query by the contact's email to find a particular contact, or query by a contact list id to grab all contacts within a list.
When this call is made, it will return 100 results at a time and will require paginating through the results. To paginate, you would add a page parameter to the url. Ex: <api_call>/api/contacts/?page=3
Get a specific contact by id
Retrieves a specific contact in your organization by providing the contact id.
Remove a contact
This endpoint removes a contact for an organization. This is a delete action and all of the contact’s data and history will be removed from the organization.
Get all feedback
Since you may have lots of feedback in different campaigns, there’s the ability to filter feedback by campaign_id, show only un-completed feedback, filter by score type, along with a few more options as query parameters.
When this call is made, it will return 100 results at a time and will require paginating through the results. To paginate, you would add a page parameter to the url. Ex: <api_call>/api/feedback/?page=3
You can feedback for a specific time period by date queries in the URL. All dates are using UTC time. Due to this, you may see slightly different number of feedbacks than what's displayed on your dashboard since your dashboard respects your timezone settings. Date formats accepted are yyyy-mm-dd and mm/dd/yyyy.
Date Examples
All feedback before a specific date: /api/feedback/?posted_date_1=2016-10-23
All feedback after a specific date: /api/feedback/?posted_date_0=2016-10-31
Feedback for a specific time period: /api/feedback/?posted_date_0=2016-10-03&posted_date_1=2016-10-23
Get a feedback by id
Retrieves a specific feedback in your organization by providing the feedback id.
Get metrics
This endpoint will retrieve all current campaign metrics within your organization.
When retrieving metrics, the default is to show metrics for the past 30 days.
You can grab metrics for a specific time period by date queries in the URL. All dates are using UTC time. Due to this, you may see slightly different metrics than what's displayed on your dashboard since your dashboard respects your timezone settings. Date formats accepted are yyyy-mm-dd and mm/dd/yyyy.
Date Examples
All metrics before a specific date: /api/metrics/?posted_date_1=2016-10-23
All metrics after a specific date: /api/metrics/?posted_date_0=2016-10-31
Metrics for a specific time period: /api/metrics/?posted_date_0=2016-10-03&posted_date_1=2016-10-23
Score analysis values:
(-100) - (-1): "AT RISK"
0 - 49: "GOOD"
50 - 74: "EXCELLENT"
75 - 100: "WORLD CLASS"
Webhooks
Events we currently support
feedback.added_or_changed
- Anytime feedback is created or changed, e.g., a user submitted a score and/or provided a comment.feedback.removed
- Anytime feedback is removed, e.g., a specific feedback was deleted by a user or admin.metric.score_changed
- Anytime the NPS score changes for a given campaign.contact.unsubscribed
- Anytime a contact unsubscribes from receiving surveys
To add a new webhook using the Promoter web application:
- Navigate to your Account Settings in Promoter.
- Click Webhooks from the menu.
- Click + Create Webhook at the top of the page.
- Choose the event you want to listen for (for example, feedback is added).
- Add your webhook URL under "Target URL".
- Choose the campaign you would like this webhook tied to.
- Click Create.
You can use RequestBin to test what our HTTP client is sending or to inspect and debug webhook requests. Data will be returned in JSON format:
feedback.added_or_changed
{
"hook": {
"id": 2416,
"event": "feedback.added_or_changed",
"target": "http://requestb.in/1ftjak41"
},
"data": {
"comment": "I love my new tablet!",
"posted_date": "2017-05-04T16:42:33Z",
"score": 10,
"campaign": 583,
"score_type": "passive",
"contact": {
"attributes": {
"plan": "bronze"
},
"first_name": "Kate",
"last_name": "Bell",
"id": 12345,
"email": "kate@mac.com"
},
"comment_updated_date": "2017-05-04T16:42:40Z",
"id": 1520285
}
}
{
"hook": {
"id": 104,
"event": "feedback.removed",
"target": "http://requestb.in/1ftjak41"
},
"data": {
"comment": "I love my new tablet!",
"posted_date": "2017-05-04T16:42:33Z",
"score": 10,
"campaign": 583,
"score_type": "passive",
"contact": {
"attributes": {
"plan": "bronze"
},
"first_name": "Kate",
"last_name": "Bell",
"id": 12345,
"email": "kate@mac.com"
},
"comment_updated_date": "2017-05-04T16:42:40Z",
"id": 1520285
}
}
{
"hook": {
"target": "http://requestb.in/1ftjak41",
"id": 251,
"event": "metric.score_changed"
},
"data": {
"potential_new_revenue": 73,
"average_revenue_per_customer": 123,
"formatted_long_term_revenue_at_risk": 73,
"campaign_name": "Pear Computers",
"followups_outstanding": 5,
"promoter_percentage": 34,
"formatted_potential_new_revenue": 73,
"followup_rate_percentage": 17,
"followup_count": 1,
"formatted_surveys_scheduled_count": "0",
"surveys_scheduled_count": 0,
"formatted_surveys_delivered_count": "0",
"score_analysis": GOOD,
"detractor_percentage": 33,
"formatted_average_revenue_per_customer": 0,
"long_term_revenue_at_risk": 0,
"passive_percentage": 0,
"surveys_delivered_count": 10,
"nps": 1,
"feedback_count": 6,
"formatted_short_term_revenue_at_risk": 123,
"feedback_rate_percentage": 60,
"short_term_revenue_at_risk": 123
}
}
{
"hook": {
"target": "http://requestb.in/1ftjak41",
"id": 249,
"event": "contact.unsubscribed"
},
"data": {
"attributes": {
"plan": "bronze"
},
"first_name": "Kate",
"last_name": "Bell",
"id": 12345,
"email": "kate@mac.com"
}
}