We're thrilled to see all the great development going on with the NationBuilder API, and want to open this forum up for public feedback, helps and hints, questions and more. This resource is curated by the NationBuilder API Team - our goal is developers helping developers, so we definitely want to hear from you. You can also use the tags to rank posts. Thanks!
Please add Petitions and Petition Signatures to the NationBuilder API
This would be very powerful for a bunch of existing integrations as well as new ones. For example, it would enable a service like CallHub to support members signing petitions via SMS. It would enable email your MP tools to track against petition pages directly within NationBuilder. It would also enable tools to report on a nation's core activities and track successes across a great range of actions.
Ideally, it would allow developers of external tools to work with NationBuilder's petitions as well as petition signatures, in the same way that we can already work with events and RSVPs (that event resource provides the best analogy).
I would say the key components would be:
- Index endpoint (to return all petitions per site)
- Create endpoint (create a new petition)
- Show/update/delete endpoints (these are less important to us, but useful all the same :)
- Petition signature Count endpoint (return the number of people who have signed a given petition)
- Petition signature Index endpoint (return the NationBuilder IDs, first names and emails of everyone who has signed a given petition)
- Petition signature Create endpoint (add a new signatory to a given petition)
Thanks for considering!
considering
Thanks CodeNation! I'll move this over to the API forum for that team to take a look at! There isn't a timeline on this at the moment but definitely a good suggestion.
Request Followups API
Would like an API to access followups set for a person (or all persons) and assigned to a user (or any user).
Theme API to Support Easy Theme Creation / Updates
zapier.com Integrations
Do you support integration using Zapier.com? This would be very helpful as it supports hundreds of different integrations in one package. Thanks!
[API] Relationships between People to People/Organizations are not available
We are not able to add relationships either between people with each other or with an organization through the API provided by NationBuilder.
We are trying to add various types of users on NationBuilder, such as adding a student and a school. However, we want to assign that a particular student has the relation "Student At" his/her school. This assignment is not available as the current API version does not support the endpoint "Relationships".
Is there a solution to set these relationships?
Thanks
Mohamed Hisham
Bug tracker
I think NB needs a bug tracker. Is there one I'm missing. Currently, we report bugs via point people or by developer email addresses that we happen to have. This system does not work for a variety of reasons.
I've reported many bugs via point people, and mostly they are misunderstood or ignored. I am sitting on about a dozen low or medium priority bugs that I'd happy report, but since I can only do so through point people I only report major, show-stopping bugs. And even then they usually don't get through to the engineers until I start squeaking.
A professional bug tracker that the engineering team can directly access, without point people as gate keepers, is important.
completed
If you're experiencing a bug, please contact our support team at [email protected] and follow these steps for reporting your bug.
Thanks!
When will API and web hooks be updated to reflect the new paths?
What is the status on webhooks/api access to paths?
People/search endpoint only returns exact matches
When I hit the search endpoint for a name, for example, I have to use the exact name to return a result. For example, if I search for first_name=brad it won't return results for 'Bradley'.
In addition, searching for names of organizations doesn't return results at all.
considering
This issue has been confirmed but does not have a set timeline on when it will be fixed. Please follow this cards if you would like to receive email updates about the status of this issue.
New "upgrade" killing off the Developers?
According to http://nationbuilder.com/feature_comparison , it looks like the Developer API is only going to be available on plans starting at a thousand dollars a month now? This effectively kills off the developer market entirely.
Was this intended? The Developer API was one of the main reasons I came to NationBuilder, and I keep my community hosted here. It's also been a huge reason for me to promote NationBuilder as an option amongst other non-profits, but the new pricing effectively destroys the potential of usage by most non-profits...
Is there any form of the API being left in the lower tiered plans?
-Reed
completed
It is true that nations on the Leader and Organization package will not have access to the API. Nations on any package can still install apps and hire a certified developer from our developer directory to build an integration with other systems using our API. The only restriction for nations on the Leader and Organization package is for them accessing the API to build a custom integration using non-certified developers.
Becoming a certified developer or publishing an app in our app directory will allow you to work with any customer regardless of the pricing package they are on. To become a certified developer please fill out this form and we'll be in touch shortly. To publish an app to our app directory please contact me directly at [email protected].
Using the API from "pure" Javascript
I'd like to call into the API from within some JavaScript code, purely running in the browser.
How can you authenticate safely if you want to use the API purely on a client side application? Many APIs allow you to restrict a token to a single or set of referrers (so they only work on sites under certain domains). Is there a similar mechanism within NationBuilder's API?
Posting Financial Transactions
Would be great if the Donations API could be opened up to read/write or that the Invoicing function be added as a read/write API so that we're able to post different types of transactions info.
For instance, an e-commerce solution could post customer sales back to the Nation either as a donation using a tracking code or by generating and closing an invoice.
completed
We've opened up write access to nearly all the donation fields. You can find the docs on our main page, and you can also view the NationBuilder Donations API on Github here.
Civicrm synchronisation
Has anyone already written code to synchronise People data between NationBuilder and a Civicrm site, using the two APIs?
We need to do that between our existing membership database and our NationBuilder site. I'd be interested to hear of any experiences from those who have already tried to do that.
Request Date Field in Contacts API
As noted else where in support, Contacts apparently default to date the contact was entered, and don't allow option to edit date to that on which contact actually occurred. This, ought to be fixed generally, and the option to edit the date added to the Contacts API
Including Paths in the API
Hi,
It would be a huge help if paths and steps were included in the API. Then we could automate much more of the importing and tracking that we do. The feature has been out for a while and it seems intuitive that the feature would be included in the API. Thanks so much!
Jenny Landon
Represent.Us
completed
Jenny,
We now have a paths API with the ability to index paths and steps. Please see the documentation.
Survey API endpoints
Is the survey aspect of the API live? When I try to update survey questions I get this response back:
{
"code":"not_found",
"message":"Record not found"
}
I am using this json to pass it through:
{
"survey_response": {
"survey_id": 1,
"person_id": 2,
"question_responses": [{
"question_id": 2,
"response": 1
}, {
"question_id": 1,
"response": "yes"
}, {
"question_id": 3,
"response": "cool"
}]
}
}
Is there any way to ajax submit a form in NationBuilder?
considering
This is not possible with our current page infrastructure.
Recording Pledge Data via the API
I'm working for a non-profit that is running a pledge drive, and has pledge form on its website. Is there any way we can move pledge data into NationBuilder via the API? I don't see pledges referenced anywhere in the documentation.
email api?
Any thoughts on an email API that could help supporters recruit others? For example, I want to start a recruiting drive where each supporter recruits at least two others. I'd like to create an app that allows people to enter a few emails, use default/editable text, and send emails out right from the page on their behalf.
submitted
Great suggestion, Bruce. We do intent to expose more communications features in the API - however, we don't presently have a timeline for this and have quite a lot of new features planned before communications. You may want to look into SendGrid's API, which we use for our mail services - you could build an email app using their tools and log new people and contacts back into NationBuilder using our existing calls.
Request an Activity Stream API
I would like an API to access the Activity Stream, as the Contacts API is only showing a portion of the communications relevant to a person. My present objective is simply to access the same information as is shown in the People dashboard in read only format.
POST/PUT endpoints do not work.
I'm using the NB api via PHP. The GET/DELETE methods both work but no matter what I try I can not edit or add a new people resource using the client->fetch() function.
The error code is always a 400 no matter how I format the parameters. Please help and don't give me a canned response to the API helper because I've spent 3.5 hours already trying various things in the documentation which is thin to say the least.
Suggestion: Address fields as parameters on the people/search endpoint.
At the moment, you can GET people/search with geographical filters City and State. It would be nice to able to also filter (for instance) on Address 1, or Street Number, Name, and Type, or ZIP. (ie. we would like to see more geographical / primary address filters exposed through the API.)
considering
This is something we will consider but does not have a timeline at the moment.
Feature Request: get and add People relationships
It would be great to see the ability via the API to get any existing relationships a person has and add new ones, as you can do via the GUI.
considering
This is something we will consider but does not have a timeline at the moment.
Using API in PHP for email sign up form; how to activate/verify email address?
I've got a script working nicely where a user visiting a WordPress site can fill out their name and email address, check the opt-in box, and sign up to a list on NationBuilder. But I can't seem to find any information on how to have NationBuilder send a verification email or double opt-in message to the new user to confirm that the email is valid and they do really truly want to be on this list. How would we go about this using the API?
Get notes on person's profile via the API
With the current People API you can add a note to a person's profile which is great! However, it would be fantastic if you could also get those notes too via the API.
considering
This is something we will consider but does not have a timeline at the moment.
PUT to people API via PHP
When i do something link this in PHP:
$params = array(
'person' => array(
'email' => '[email protected]','home_address' => array('country' => 'Germany', 'zip' => '66666' ))
);
$header = array('Authorization:' => $token,'Content-Type:' => 'application/json', 'Accept:' => 'application/json');
$response = $client->fetch($baseApiUrl . '/api/v1/people/push?access_token=myaccesstoken', $params, 'PUT',$header);
print_r($response);
i get the following response
Array
(
[result] => Array
(
[code] => missing_parameters
[message] => Missing Parameters.
[parameters] => Array
(
[0] => person
)
[inner_error] => Array
(
[name] => Api::Error::MissingParameters
[message] => Missing parameters: person
)
)
[code] => 400
[content_type] => application/json
)
Whats wrong with the Parameters? Do i need to add something else to the Params?
submitted
Alexander, I sent you an email with a proposed solution; let me know if that works for you.
thanks, Arion Hardison
People Create Endpoint and PHP.
Comments API
Any chance we’ll see access to the Page Comments API in the near future? I’d love to be able to leverage Disqus comments without sacrificing the value of the native comment platform (i.e., creating new signup records and appending comment information to existing ones).
App Integration Leading Practices?
I'll frame this question in a general way so it applies to other 3rd party app developers, not just me:
What level of API integration are NB customers asking for?
For example, if you build a third-party app that can help members of a nation interact with each other (i.e. group chat or something else), there are several ways I can imagine that you'd want to integrate it with NB, each with a different level of complexity:
- No integration: Just listing an app in the app directory, essentially as an ad for the app-- probably not an option.
- Minimal integration: Include the app in an iframe and have either no sign-in requirement or require that the members of the nation sign in a second time within the app's iframe as part of the app's authentication process.
- Deep integration: Connect to the People API so that members of a nation can sign into your app from within a NB page for that nation.
- Other options?
Are any of those options emerging as common or recommended?
What are NB customer expectations around 3rd party app integration? I don't expect they'd be too happy with requiring that the members of their nation sign in twice-- once to NB and once to the app. That's what I found with one client I worked with.
Thanks!
Imports via API incorrectly allocating records as prospects
I have imported a number of records via the API, which all have an email address and email_opt_in='Y', but the
records are being imported as PROSPECTS. Whereas http://nationbuilder.com/how_support_status_is_determined says:
"Records imported with:
* support level = 1
* support level = 2
* email address and email opt-in = Y
* mobile number and mobile opt-in = Y
will always be supporters."
considering
This issue has been confirmed but does not have a set timeline on when it will be fixed. Please follow this cards if you would like to receive email updates about the status of this issue.
People Credentials
I mean, is it possible that people from my nation logs in my app with their nationbuilder credentials (user and password)?
API bulk tag removal
I'm having problems with the bulk tag removal API. For example, using the API explorer for my nation I send the following:
DELETE | Bulk Tag Removal|
/people/:id/taggings with id = 123 and body:
{ "tagging": { "tag": ["hello"] } }
I get response code: 400 { "code":"missing_parameters","message":"Missing Parameters.","parameters":["tagging"]}
In contrast, the API for adding tags works as expected. This has exactly the same syntax except the request is a PUT not a DELETE.
completed
This bug has been fixed.
How does one create a sub page of a page through the API
There doesn't seem to be a way to either create pages as sub pages through the api or to attach existing pages to other pages as sub-pages.
Any help would be appreciated.
Thanks,
Steve
submitted
Steve, parent/child page relationships are not presently represented in the API. We'll review adding those parameters.
Webhooks do not immediately trigger when adding a tag
When adding a tag to someone in your database, the 'person changed' webhook will not fire until you save that profile or a different profile in the database. This makes syncing tags with an external database a challenge.
When Installing Field Edge app it disappears from my Control Panel
When I install Field Edge it doesn't appear in Installed Apps or in the app listing. This makes me concerned it's not installed.
submitted
We are investigating why FieldEdge doesn't show up under 'Installed Apps.' After testing the integration, it is clear that FieldEdge is syncing with the nation so functionality is not limited due to this issue.
API Explorer broken on donations and people search endpoints
As per my previous two posts concerning these matters, the people and search endpoints return a 400 when provided with unexpected URL parameters. The API Explorer provides them with one of these, __proto__. This should be removed so that the API Explorer actually works on these endpoints. https://nationbuilder.com/jeremyunite/bad_request_on_people_search_endpoint https://nationbuilder.com/jeremyunite/bad_request_on_donations_search_endpoint
considering
Thanks for noting this Jeremy. We have flagged it with our product and engineering team. There is no set timeline on when this change will go into effect but we will update this posting when it does.
Search by any parameter
I’m working with my nation’s donation data, and I’d like to be able to search by more than just succeeded since, created since, failed since, and donor id.
Is there any reason why I can’t pass tracking_code_id as a search parameter, or any of the other fields? Right now, my flow looks like this:
Pull the entire list of donations that might match (say, by succeeded since date, or just pull them all)
Parse through and check the value/run my own search algorithm on the entire results I just pulled
Do my processing
Since I’m sometimes interested in searching all of our donations, that means each time I do this, I’m pulling down almost all of our donations, even if only 5-10 of them will match a criteria, like a tracking_code_id – it’s much slower than it needs to be, I think.
Have I missed something? Is there a better way to use the search endpoint? What’s in the way of giving us access to this?
considering
Tyler,
At this point we have only exposed the succeeded_at, created_since, failed_since, and donor_id search params for the donation search endpoint. There is not a way to run a targeted query via the API for just tracking codes.
We will consider adding a tracking_code_slug param in the future and will update this card and notify you when that is complete.
Provide a way to list surveys through the API that do not require them to be on a Page.
Hi folks,
I want to use the surveys to let canvassers add extra details while they are contacting people using an app I am designing. Right now I am getting a list of surveys by hitting /api/v1/sites/:site_slug/pages/surveys
However, this only includes surveys that have a corresponding page made for them, so the user must first make a survey and *then* add it to a page on a site. Not the easiest!
Is it possible to just provide an endpoint that lists all surveys without requiring them to be on a page first?
Thanks!
considering
This is something we will consider but does not have a timeline at the moment.
PUT request
We're making a request to an offsite domain, and when I making a PUT request to the offsite server via $.ajax, it looks as if the authenticity token is being concatenated to the end of the stringified JSON object - this obviously causes problems when our offsite server attempts to parse the JSON object, it finds a "&authenticity_token=..." which is not valid JSON.
It looks as if the check of how the authenticity token should be appended (I snooped around a bit in the minified liquid files) is a bit naive. Yes, we're sending up JSON, but best practice (http://stackoverflow.com/a/12693986 <http://stackoverflow.com/a/12693986>) is to stringify with $.ajax first. The authenticity token attachment logic incorrectly interprets the stringified JSON to be a query string.
I have solved this for the most part by preventing this event handler from firing by including the 'global:false;' option in the AJAX request. Thanks!
submitted
Hi Luke,
You should be able to stringify your JSON data in an $.ajax request, though it sounds like you were able to resolve this on your own by setting the global parameter to false. If you're still running into issues, however, you can send your examples to [email protected] and we'd be happy to investigate further.
FWIW, another developer seemed to encounter a similar error and was able to resolve by removing the accepts parameter: JSON/jQuery formatting for People create?
Tags Endpoint Doesn't Accept Forward Slashes
I'm trying to use the GET /tags/:tag/people endpoint, searching for a tag such as "Ajax/Bowmanville" and getting a 404 response. It works fine with a tag like "Ajax-Pickering" which doesn't have the front slash. I've tried replacing the front slashes with %2F, as suggested here http://nationbuilder.com/mdunbar50/issue_with_space_and_in_people_tags_search but it doesn't help. Any advice would help! Thanks
considering
We have confirmed this bug but do not have a timeline for when a fix for this issue will be implemented. But we've noted it and will post any updates here.
Looking for the "right" way to hook into the form submission API
Hi folks, we'd like to add some JS actions—adding content to fields—to an NationBuilder form on submit before the form validation/send is triggered. However binding on the form submit handler triggers after the NationBuilder actions and the data is not captured.
Is there an elegant/sanctioned way to hook into the event dispatcher? Essentially I need a callback before the form submits though NationBuilder XHR channels. Someone has a gist of how to do this, but the timing of this isn't correct (form still submits).
Query Recurring Donors?
I'm trying to figure out the most efficient way to pull a list of people in my organization who are recurring donors. This seems to be relatively straightforward from the people admin page through the web portal, but it does not look like I can set a query parameter for this through the People API. It looks like the only way to do this is to go through the Donation API, but there it looks like I will have to make a very large number of API calls as there isn't an easy way to filter on this either. Is there an alternate solution? Thanks.
Batch updating and importing Blog Posts via API
I would think that many others would have had to migrate from Wordpress or Drupal to Nationbuilder by this point, but I can't seem to find many resources.
Seeing as there is no way to batch import posts I created a script to do so, and categorize them under their respective parent blog within Nationbuilder- attaching an 'external_id'.
So now, to update these same posts (content authors have made edits on old site during NB development) I have to first make a GET request to /sites/:site_slug/pages/blogs/:id/match to get the external id, then another UPDATE request to /sites/:site_slug/pages/blogs/:blog_id/posts/:blog_post_id .
Is there was an UPDATE or DELETE by 'external_id' method available or in the works? Many developers will be migrating to Nationbuilder and these functions alone will make the migration process easier- and open the doors to CSV batch editing for larger sites.
considering
This is something we will consider but does not have a timeline at the moment.
However we are paying close attention to the most popular suggestions so please share and encourage others to follow and comment!
I am facing issues with http and https to https//www.
I am facing issues with http and https to https//www. is not redirect. http is redirecting https//www. but https is not redirect. Can anyone suggest me how we resolve it
error "nation_not_found"
I followed the PHP API Quickstart guide http://nationbuilder.com/php_quickstart and was able to easily obtain an access token. However, when I am trying to use the API in any way I get the following error response:
Array ( [result] => Array ( [error] => nation_not_found [message] => The nation identified by this request was not found. ) [code] => 404 [content_type] => application/json )
My nation is safestreets.nationbuilder.com, is there a setting I have to enable in order to use the API? Thanks.
submitted
Eric, the nation slug for safestreets was previously schoolmeals - you'll be able to use the API with the original name.
Set address used as primary address
Using the API, how can I update which address is currently used as the primary address? e.g. mailing, home, billing, ... It would also make sense if the person object included which address is currently set as the primary address. This is helpful to know which address to update.
submitted
It isn't possible to change which address is the primary address via the API. If it is not set manually in the control panel, the primary address is set automatically to the first present address in this hierarchy:
1. home
2. registered
3. billing
4. work
5. mailing
6. user-submitted
7. Twitter
If you wish a different address to be the primary for a group of records, you would need to run a batch update in the control panel.
How to get client id and api secret
How to get client id and api secret
completed
Steps 3 and 4 of our API Quickstart guide describe how to obtain a client ID and API access token:
Subscribe to list widget
I want to add a box to my site that allows users to sign up for a mailing list that we are now migrating to NationBuilder.
My site is Python/Django. I have this already set up with Mailchimp.
The Python Quickstart doc doesn't explain what the variables 'code' or 'REDIRECT_URI' are or how they should function in step 4.
This should be pretty basic functionality. Am I missing something? Is there a simpler way to implement this?
completed
Brett, for a single-nation use, just use an app test token - you can find that in your nation's control panel under Settings > Apps.
How to save access token in PHP?
I've tried saving the access token as a key/value pair in the $_SESSION variable, but if
a) I encrypt it and then save it, on the next page or request, it has changed or
b) I don't encrypt it and save it as a string, it is deleted from $_SESSION on the next page.
What am I doing wrong here? I need to make multiple requests in sequence and have a feeling I shouldn't need to ask for a new access token with each one. Thanks!
submitted
Can you paste the code?
I have a few questions here
1) Why are you encrypting the access token?
2) When you say "save" you just as a session variable or are you saving to a DB?
3) How are you saving it to $_SESSION and do you have this issue with any other variables? If so check your PHP version because $_SESSION and other register globals were deprecated in 5.3 and removed in 5.4
I would guess you are doing something like (see below)
<?php
session_start();
$_SESSION['token']=<access token here>;
?>
If you are losing your the value on the next page perhaps you are not passing a session identifier and calling session_start which would cause a new session to start.
Searching people returns invalid json format error
I am searching people using this url:
https://malaysia.nationbuilder.com/api/v1/people/search?access_token=my_tokken
with header "Content-Type: application/json" and with following request body:
{"first_name":"abc"}
but it gives me error that json format is invalid
completed
You can accomplish this search with a cURL command wrapping your JSON into the URL. See below for the command you can run in Terminal:
curl https://malaysia.nationbuilder.com/api/v1/people/search?access_token=[my test token here] -X GET -H “Content-Type: application/json” -d ‘{"first_name":"abs"}’
Test Token Example
You have great examples on how to navigate the minefield that is OAUTH, but now that you have test tokens, I'd like to see some simple example code on how to use the test token (python/php or even curl).
Thanks
Dennis
completed
curl https://[slug].nationbuilder.com/api/v1/people/search?access_token=[my test token here] -X GET -H “Content-Type: application/json” -d ‘{"first_name":"Arion"}’