Skip to main content

API Developers Forum

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 check your e-mail for a link to activate your account.
Sort by

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:

  1. Index endpoint (to return all petitions per site)
  2. Create endpoint (create a new petition)
  3. Show/update/delete endpoints (these are less important to us, but useful all the same :)
  4. Petition signature Count endpoint (return the number of people who have signed a given petition)
  5. Petition signature Index endpoint (return the NationBuilder IDs, first names and emails of everyone who has signed a given petition)
  6. 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. 

Official response from

36 reactions

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).

22 reactions

Theme API to Support Easy Theme Creation / Updates

I know there is the Mac theme sync tool but for those not using Mac, NationBuilder theme development is a pain. Also for those of us using continuous deployment that wouldn't be of any help as most probably aren't using Mac for that.
 
We wrote a Shopify Desktop Theme Editor for any platform to handle this for Shopify users through Shopify's theme endpoint but were wondering if there would ever be a NationBuilder endpoint for this?
Any other NationBuilder devs who'd like this?

 

26 reactions

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!

25 reactions

[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

21 reactions

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!

Official response from

16 reactions

When will API and web hooks be updated to reflect the new paths?

What is the status on webhooks/api access to paths?

11 reactions

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.

Official response from

12 reactions

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].

Official response from

18 reactions

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?

 

14 reactions

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.

Official response from

14 reactions

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.

11 reactions

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

8 reactions

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.

Official response from

11 reactions

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"
}]
}
}

10 reactions

Is there any way to ajax submit a form in NationBuilder?

considering

This is not possible with our current page infrastructure.

Official response from

9 reactions

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.

6 reactions

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. 

5 reactions

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.

3 reactions

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.

11 reactions

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.

Official response from

7 reactions

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.

Official response from

6 reactions

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?

4 reactions

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.

Official response from

13 reactions

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?

 

 

 

13 reactions

People Create Endpoint and PHP.

Hello, I am trying to create an application with People Create Endpoint and the PHP API.
'Get Peoples' works perfect but when I try to add a new person in my Nation, the problems begin.
My token is valid, because I tested it with the new API Explorer tool.
My example with GET is:
$ token = ' MyToken ';
$ client -> setAccessToken ($ token );
$ response = $ client -> fetch ( $ baseApiUrl '/ api/v1/people /'. )
print_r ( $ response );

This shows all the Peoples in my nation.
And this is the example I'm using with POST:
$ token = ' MyToken ';
$ client -> setAccessToken ($ token );
/ *
$ data = array (
    'person ' = > array (
        'email' = > ' [email protected] ' , " last_name " = > " Smith ", " first_name " = > "Bob"
    )
) ;
$ data_string = json_encode ( $ data );
$ response = $ client -> fetch ( $ baseApiUrl '/ api/v1/people / ', $ data_string , "POST" . )
print_r ( $ response );
I'm not getting any response neither in the browser nor in the curl_request_info file.
What is wrong with my code?
I'm using Ryan Morgan's library ( https://github.com/RyanMorgan/PHP-OAuth2 ) .
I hope someone can help me or show me one example of how to do a POST Request for People correctly?
Thank you very much!
7 reactions

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).

3 reactions

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!

2 reactions

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.

Official response from

4 reactions

People Credentials

Hello I'm wondering if there is a way to use the people credentials from a nation into my application. 
I mean, is it possible that people from my nation logs in my app with their nationbuilder credentials (user and password)? 
I saw an app called oneclickpolitics which ensures that "NationBuilder customers can very Quickly and Securely login using their NationBuilder accounts." 
How can I do that? Am I missing some functionality from the nationbuilder API? As far as I know, the people endpoint returns no credentials. 
I would really appreciate any suggestions or help.
Thank you!
6 reactions

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.

Official response from

6 reactions

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

8 reactions

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.

4 reactions

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. 

3 reactions

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.

Official response from

4 reactions

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.

Official response from

5 reactions

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.

Official response from

2 reactions

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!

4 reactions

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. 

Official response from

2 reactions

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).

1 reaction

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.

3 reactions

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!

Official response from

2 reactions

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

2 reactions

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.

 

3 reactions

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.

6 reactions

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:

http://nationbuilder.com/api_quickstart

Official response from

2 reactions

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.

Official response from

2 reactions

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!

4 reactions

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"}’ 

Official response from

3 reactions

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"}’ 

Official response from

2 reactions

Liquid error: Internal error