Calling
›
Texting
›
Email
›
Relational organizing
›
Voter Universe
›
Insights
›
Campaign tools
›
Run a labor union membership drive
A step-by-step guide to growing your membership.
Read the guide →
Talk to a 10DLC expert
Get compliant and keep your texts delivering.
Get expert help →
Watch our latest webinar
See how campaigns run smarter with CallHub.
Watch now →
Run unified campaigns for better reach
One campaign. Every channel. Automatic.
See how it works →
Industry
Advocacy
›
Unions
›
Nonprofit
›
Political
›
Partners
Organizations and agencies we work with to help campaigns run smarter.
NationBuilder Democracy Partners PDI
View all →
Pricing

How to batch delete lists on NationBuilder

At CallHub, we work closely with customers on their political phone banking and SMS marketing campaigns. A lot of our customers use NationBuilder as their primary CRM. We’ve built a great integration with NationBuilder that we’re proud of. Some of our customers do come to us if they have specific issues with their setup. One such client had way too many stagnant lists in his NationBuilder account. Unfortunately, there isn’t an easy way to delete lists in one go. NationBuilder does not let you batch delete a large number of lists. I thought I’d take a shot at this problem considering my comfort level with NationBuilder as a developer. It took me a weekend but I figured it out. Here is my solution on how to batch delete lists on NationBuilder. how to delete lists in NationBuilder

Key Takeaways

NationBuilder does not support batch deletion of lists natively, so CallHub built a Python script to let administrators delete many stagnant lists at once.

Prerequisites

  • Python is required to run the script, and Mac El Capitan already ships with Python 2.7 installed while Windows users need to install the Python executable separately.
  • A NationBuilder access token is required, which can be generated by an administrator under Settings > Developer > API Token by clicking Create Token.
  • Users who are not administrators must request access or ask an administrator to generate the token on their behalf.
  • The IDs of the lists to be deleted are needed, which can be found in the list’s URL, and a sequential range such as 5:12 can be passed instead of individual IDs.

Running the script

  • The script is available for download or cloning from the CallHub GitHub repository, with the relevant files located under callhub-examples-master/utilities.
  • Mac users run the script from Terminal using ./deletelist.py followed by the slug, access token, and list ID or IDs.
  • Windows users run the script from CMD using py deletelist.py with the same slug, access token, and list ID parameters, or a start:end range.
  • The required parameters are the NationBuilder slug, the access token obtained from the developer settings, and the ID, IDs, or range of IDs of the lists to delete.

Additional tools

  • CallHub also provides an Add Tag script for tagging a large number of people at once on NationBuilder.
  • A corresponding Remove Tag script is available for removing a tag from a large number of people in one operation.

What you need

Python

If you have a Mac, El Capitan comes with Python 2.7 installed. If you have a Windows machine, you can install the Python executable.

NationBuilder Access token

Get Nationbuilder Access Token

Get NationBuilder Access Token

To run a script on NationBuilder you need to use an Access token. Here are steps on how to generate your access token. You need to be an administrator of the Nation to be able to generate a token. If you are not an administrator, either request for access or ask the administrator to follow these steps to generate an access token.
  1. Go to Settings > Developer > API Token and click on Create Token.
  2. Copy the token.

 List ID

Get the IDs of the list you’d like to delete. If the lists are in sequence, you can even pass a range of IDs to the script. For example, if you want to delete all the lists with ID from 5 to 12 then pass <5:12> to the script as a parameter. Unsure of how to get the ID for a list? You’ll find the ID in the url of the list.
nationbuilder list id

NationBuilder list id

Download the script

The code is available for download or for cloning from the CallHub GitHub repository. Unzip the files and access the files under callhub-examples-master/utilities. [pivot_button text=”Download the script” url=”https://github.com/callhub/callhub-examples”]

Run the script

To run the script, you need access to a terminal / CLI. If you are on a Mac, use Terminal. If you are on a Windows machine launch the Windows command line program CMD. Switch to the directory callhub-examples-master/utilities, the directory in which the files are placed and then run the following command, depending on your OS.

Mac

./deletelist.py <slug> <access_token> <list_id> <list_id>

Windows

py deletelist.py <slug> <access_token> <list_id> <list_id>
OR
py deletelist.py <slug> <access_token> <start:end>

Where:

<slug> Is your NationBuilder slug <access_token> Is the access token you got in the previous step <list_id> Is the ID or IDs or range of IDs of the lists you want to delete

Bulk Delete NationBuilder lists

Bulk Delete NationBuilder lists

That’s all folks!

Yes, it’s that easy. Head over to your nation to find all your errant lists gone. We’ve also thrown in a couple of other scripts that will help speed up your batch operations on NationBuilder.

Add Tag

Use this script to tag a large number of people at once.

Remove Tag

Use this script to remove a tag from a large number of people at one go.
If you’d like to get more tips and content on NationBuilder, subscribe now!