Action Network

Overview

Action Network is an online tool for storing information and organizing volunteers and donors. It is used primarily for digital organizing and event mangement. For more information, see Action Network developer docs

Note

Authentication

Only ActionNetwork accounts of the partner tier are able to access their API. You can generate your key from the API & Sync page, located in the Start Organizing menu, under Details.

Quick Start

To instantiate a class, you can either pass in the API token as an argument or set the AN_API_TOKEN environmental variable.

from parsons import ActionNetwork

# First approach: Use API credentials via environmental variables
an = ActionNetwork()

# Second approach: Pass API credentials as arguments
an = ActionNetwork(api_token='MY_API_TOKEN')

You can then call various endpoints:

# List all people stored in Action Network
all_contacts = an.get_people()

# Add a person
an.add_person('person.email@fakeemail.com')

# Add a tag
an.add_tag('fake_tag')

# Update a person
an.update_person('fake_id', given_name='new_given_name', tags=['tag_1', 'tag_2'])

API

class parsons.ActionNetwork(api_token=None)[source]
Args:
api_token: str

The OSDI API token

get_advocacy_campaigns(limit=None, per_page=25, page=None, filter=None)[source]
Args:
limit:

The number of entries to return. When None, returns all entries.

per_page:

The number of entries per page to return. 25 maximum.

page:

Which page of results to return

filter:

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all of the advocacy_campaigns (letters) entries

get_advocacy_campaign(advocacy_campaign_id)[source]
Args:
advocacy_campaign_id:

The unique id of the advocacy_campaign

Returns:

A JSON with advocacy_campaign entry

get_person_attendances(person_id, limit=None, per_page=25, page=None, filter=None)[source]
Args:
person_id:

The unique id of the person

limit:

The number of entries to return. When None, returns all entries.

per_page:

The number of entries per page to return. 25 maximum.

page:

Which page of results to return

filter:

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all the attendances entries

get_event_attendances(event_id, limit=None, per_page=25, page=None, filter=None)[source]
Args:

event_id: the unique id of the event limit:

The number of entries to return. When None, returns all entries.

per_page

The number of entries per page to return. 25 maximum.

page

Which page of results to return

filter

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with the attendances entries related to the event

get_event_attendance(event_id, attendance_id)[source]
Args:
event_id:

The unique id of the event

attendance_id:

The unique id of the attendance

Returns:

A JSON with the attendance entry

get_person_attendance(person_id, attendance_id)[source]
Args:
person_id:

The unique id of the person

attendance_id:

The unique id of the attendance

Returns:

A JSON with the attendance entry

get_campaigns(limit=None, per_page=25, page=None, filter=None)[source]
Args:
limit:

The number of entries to return. When None, returns all entries.

per_page:

The number of entries per page to return. 25 maximum.

page:

Which page of results to return

filter:

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all of the campaigns entries

get_campaign(campaign_id)[source]
Args:
campaign_id:

The unique id of the campaign

Returns:

A JSON with the campaign entry

get_custom_fields()[source]
Args:

None

Returns:

A JSON with the custom_fields associated with your API key.

get_donation(donation_id)[source]
Args:

donation_id: The unique id of the donation

Returns:

A JSON with donation data

get_donations(limit=None, per_page=25, page=None, filter=None)[source]
Args:
limit:

The number of entries to return. When None, returns all entries.

per_page:

The number of entries per page to return. 25 maximum.

page:

Which page of results to return

filter:

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all the donations entries

get_fundraising_page_donations(fundraising_page_id, limit=None, per_page=25, page=None, filter=None)[source]
Args:

fundraising_page_id: The id of the fundraiser limit:

The number of entries to return. When None, returns all entries.

per_page

The number of entries per page to return. 25 maximum.

page

Which page of results to return

filter

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with fundraising_page entry

get_person_donations(person_id, limit=None, per_page=25, page=None, filter=None)[source]
Args:

person_id: The id of the person limit:

The number of entries to return. When None, returns all entries.

per_page

The number of entries per page to return. 25 maximum.

page

Which page of results to return

filter

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all donations related to person

get_embeds(action_type, action_id)[source]
Args:
action_type:

The action type (petition, events, etc.)

action_id:

The unique id of the action

Returns:

A JSON with the embeds (for you to be able to embed action outside of ActionNetwork).

get_event_campaigns(limit=None, per_page=25, page=None, filter=None)[source]
Args:
limit:

The number of entries to return. When None, returns all entries.

per_page:

The number of entries per page to return. 25 maximum.

page:

Which page of results to return

filter:

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all the event_campaigns entries

get_event_campaign(event_campaign_id)[source]
Args:
event_campaign_id:

The unique id of the event_campaign

Returns:

A JSON with event_campaign entry

get_events(limit=None, per_page=25, page=None, filter=None)[source]

Args:

limit:

The number of entries to return. When None, returns all entries.

per_page

The number of entries per page to return. 25 maximum.

page

Which page of results to return

filter

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all the events entries

get_event(event_id)[source]
Args:

event_id: the unique id of the event

Returns:

A JSON with event entry

get_event_campaign_events(event_campaign_id, limit=None, per_page=25, page=None, filter=None)[source]
Args:
event_campaign_id:

The unique id of the event_campaign

limit:

The number of entries to return. When None, returns all entries.

per_page

The number of entries per page to return. 25 maximum.

page

Which page of results to return

filter

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all the eventes related to the event_campaign entry

create_event(title, start_date=None, location=None)[source]

Create an event in Action Network

Args:
title: str

The public title of the event

start_date: str OR datetime

OPTIONAL: The starting date & time. If a string, use format “YYYY-MM-DD HH:MM:SS” (hint: the default format you get when you use str() on a datetime)

location: dict

OPTIONAL: A dict of location details. Can include any combination of the types of values in the following example: .. code-block:: python

my_location = {

“venue”: “White House”, “address_lines”: [

“1600 Pennsylvania Ave”

], “locality”: “Washington”, “region”: “DC”, “postal_code”: “20009”, “country”: “US”

}

Returns:

Dict of Action Network Event data.

get_forms(limit=None, per_page=25, page=None, filter=None)[source]
Args:
limit:

The number of entries to return. When None, returns all entries.

per_page

The number of entries per page to return. 25 maximum.

page

Which page of results to return

filter

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all the forms entries

get_form(form_id)[source]
Args:
form_id:

The unique id of the form

Returns:

A JSON with form entry

get_fundraising_page(fundraising_page_id)[source]
Args:

fundraising_page_id: The id of the fundraiser

Returns:

A JSON with fundraising_page entry

get_fundraising_pages(limit=None, per_page=25, page=None, filter=None)[source]
Args:
limit:

The number of entries to return. When None, returns all entries.

per_page

The number of entries per page to return. 25 maximum.

page

Which page of results to return

filter

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all the fundraising_pages entries

get_items(list_id, limit=None, per_page=25, page=None, filter=None)[source]
Args:
list_id:

The unique id of the list

limit:

The number of entries to return. When None, returns all entries.

per_page:

The number of entries per page to return. 25 maximum.

page:

Which page of results to return

filter:

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all the list item entries

get_item(list_id, item_id)[source]
Args:
list_id:

The unique id of the list

item_id:

The unique id of the item

Returns:

A JSON with the item entry

get_lists(limit=None, per_page=25, page=None, filter=None)[source]
Args:
limit:

The number of entries to return. When None, returns all entries.

per_page:

The number of entries per page to return. 25 maximum.

page:

Which page of results to return

filter:

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all the list entries

get_list(list_id)[source]
Args:
list_id:

The unique id of the list

Returns:

A JSON with the list entry

get_messages(limit=None, per_page=25, page=None, filter=None, unpack_statistics=False)[source]
Args:
limit:

The number of entries to return. When None, returns all entries.

per_page:

The number of entries per page to return. 25 maximum.

page:

Which page of results to return

filter:

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

unpack_statistics:

Whether to unpack the statistics dictionary into the table. Default to False.

Returns:

A Parsons Table with all the messages related entries

get_message(message_id)[source]
Args:
message_id:

The unique id of the message

Returns:

A JSON with the signature entry.

get_metadata()[source]
Args:

None

Returns:

A JSON with the metadata entry

get_advocacy_campaign_outreaches(advocacy_campaign_id, limit=None, per_page=25, page=None, filter=None)[source]
Args:
advocacy_campaign_id:

The unique id of the advocacy_campaign

limit:

The number of entries to return. When None, returns all entries.

per_page:

The number of entries per page to return. 25 maximum.

page:

Which page of results to return

filter:

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all the outreaches entries related to the advocacy_campaign_id

get_person_outreaches(person_id, limit=None, per_page=25, page=None, filter=None)[source]
Args:
person_id:

The unique id of the person

limit:

The number of entries to return. When None, returns all entries.

per_page:

The number of entries per page to return. 25 maximum.

page:

Which page of results to return

filter:

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all the outreaches entries related to our group

get_advocacy_campaign_outreach(advocacy_campaign_id, outreach_id)[source]
Args:
advocacy_campaign_id:

The unique id of the campaign

outreach_id:

The unique id of the outreach

Returns:

A JSON with the outreach entry

get_person_outreach(person_id, outreach_id)[source]
Args:
person_id:

The unique id of the campaign

outreach_id:

The unique id of the outreach

Returns:

A JSON with the outreach entry

get_people(limit=None, per_page=25, page=None, filter=None)[source]
Args:
limit:

The number of entries to return. When None, returns all entries.

per_page

The number of entries per page to return. 25 maximum.

page

Which page of results to return

filter

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A list of JSONs of people stored in Action Network.

get_person(person_id)[source]
Args:
person_id:

Id of the person.

Returns:

A JSON of the entry. If the entry doesn’t exist, Action Network returns {'error': 'Couldn't find person with id = <id>'}.

upsert_person(email_address=None, given_name=None, family_name=None, tags=None, languages_spoken=None, postal_addresses=None, mobile_number=None, mobile_status='subscribed', background_processing=False, **kwargs)[source]

Creates or updates a person record. In order to update an existing record instead of creating a new one, you must supply an email or mobile number which matches a record in the database.

Identifiers are intentionally not included as an option on this method, because their use can cause buggy behavior if they are not globally unique. ActionNetwork support strongly encourages developers not to use custom identifiers.

Args:
email_address:
Either email_address or mobile_number are required. Can be any of the following
  • a string with the person’s email

  • a list of strings with a person’s emails

  • a dictionary with the following fields
    • email_address (REQUIRED)

    • primary (OPTIONAL): Boolean indicating the user’s primary email address

    • status (OPTIONAL): can taken on any of these values
      • “subscribed”

      • “unsubscribed”

      • “bouncing”

      • “previous bounce”

      • “spam complaint”

      • “previous spam complaint”

given_name:

The person’s given name

family_name:

The person’s family name

tags:

Optional field. A list of strings of pre-existing tags to be applied to the person.

languages_spoken:

Optional field. A list of strings of the languages spoken by the person

postal_addresses:

Optional field. A list of dictionaries. For details, see Action Network’s documentation: https://actionnetwork.org/docs/v2/person_signup_helper

mobile_number:
Either email_address or mobile_number are required. Can be any of the following
  • a string with the person’s cell phone number

  • an integer with the person’s cell phone number

  • a list of strings with the person’s cell phone numbers

  • a list of integers with the person’s cell phone numbers

  • a dictionary with the following fields
    • number (REQUIRED)

    • primary (OPTIONAL): Boolean indicating the user’s primary mobile number

    • status (OPTIONAL): can taken on any of these values
      • “subscribed”

      • “unsubscribed”

mobile_status:

‘subscribed’ or ‘unsubscribed’

background_request: bool

If set true, utilize ActionNetwork’s “background processing”. This will return an immediate success, with an empty JSON body, and send your request to the background queue for eventual processing. https://actionnetwork.org/docs/v2/#background-processing

**kwargs:

Any additional fields to store about the person. Action Network allows any custom field.

Adds a person to Action Network

add_person(email_address=None, given_name=None, family_name=None, tags=None, languages_spoken=None, postal_addresses=None, mobile_number=None, mobile_status='subscribed', **kwargs)[source]

Creates a person in the database. WARNING: this endpoint has been deprecated in favor of upsert_person.

update_person(entry_id, background_processing=False, **kwargs)[source]

Updates a person’s data in Action Network, given their Action Network ID. Note that you can’t alter a person’s tags with this method. Instead, use upsert_person.

Args:
entry_id:

The person’s Action Network id

background_processing: bool

If set true, utilize ActionNetwork’s “background processing”. This will return an immediate success, with an empty JSON body, and send your request to the background queue for eventual processing. https://actionnetwork.org/docs/v2/#background-processing

**kwargs:
Fields to be updated. The possible fields are
email_address:
Can be any of the following
  • a string with the person’s email

  • a dictionary with the following fields
    • email_address (REQUIRED)
      • primary (OPTIONAL): Boolean indicating the user’s

      primary email address

    • status (OPTIONAL): can taken on any of these values
      • “subscribed”

      • “unsubscribed”

      • “bouncing”

      • “previous bounce”

      • “spam complaint”

      • “previous spam complaint”

given_name:

The person’s given name

family_name:

The person’s family name

languages_spoken:

Optional field. A list of strings of the languages spoken by the person

postal_addresses:

Optional field. A list of dictionaries. For details, see Action Network’s documentation: https://actionnetwork.org/docs/v2/people#put

custom_fields:

A dictionary of any other fields to store about the person.

get_petitions(limit=None, per_page=25, page=None, filter=None)[source]
Args:
limit:

The number of entries to return. When None, returns all entries.

per_page:

The number of entries per page to return. 25 maximum.

page:

Which page of results to return

filter:

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all of the petitions entries

get_petition(petition_id)[source]
Args:
petition_id:

The unique id of the petition

Returns:

A JSON with the petition entry

get_queries(limit=None, per_page=25, page=None, filter=None)[source]
Args:
limit:

The number of entries to return. When None, returns all entries.

per_page:

The number of entries per page to return. 25 maximum.

page:

Which page of results to return

filter:

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all the query entries

get_query(query_id)[source]
Args:
query_id:

The unique id of the query

Returns:

A JSON with the query entry

get_petition_signatures(petition_id, limit=None, per_page=25, page=None, filter=None)[source]
Args:
petition_id:

The unique id of the petition

limit:

The number of entries to return. When None, returns all entries.

per_page:

The number of entries per page to return. 25 maximum.

page:

Which page of results to return

filter:

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all the signatures related to the petition entry

get_person_signatures(person_id, limit=None, per_page=25, page=None, filter=None)[source]
Args:
person_id:

The unique id of the person

limit:

The number of entries to return. When None, returns all entries.

per_page:

The number of entries per page to return. 25 maximum.

page:

Which page of results to return

filter:

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all the signatures related to the petition entry

get_petition_signature(petition_id, signature_id)[source]
Args:
petition_id:

The unique id of the petition

signature_id:

The unique id of the signature

Returns:

A JSON with the signature entry

get_person_signature(person_id, signature_id)[source]
Args:
person_id:

The unique id of the person

signature_id:

The unique id of the signature

Returns:

A JSON with the signature entry

get_form_submissions(form_id, limit=None, per_page=25, page=None, filter=None)[source]
Args:
form_id:

The unique id of the form

limit:

The number of entries to return. When None, returns all entries.

per_page:

The number of entries per page to return. 25 maximum.

page:

Which page of results to return

filter:

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all the submissions entries related to the form

get_person_submissions(person_id, limit=None, per_page=25, page=None, filter=None)[source]
Args:
person_id:

The unique id of the person

limit:

The number of entries to return. When None, returns all entries.

per_page:

The number of entries per page to return. 25 maximum.

page:

Which page of results to return

filter:

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all the submissions entries related with our group

get_form_submission(form_id, submission_id)[source]
Args:
form_id:

The unique id of the form

submission_id:

The unique id of the submission

Returns:

A JSON with the submission entry

get_person_submission(person_id, submission_id)[source]
Args:
person_id:

The unique id of the submission

submission_id:

The unique id of the submission

Returns:

A JSON with the submission entry

get_tags(limit=None, per_page=None)[source]
Args:
limit:

The number of entries to return. When None, returns all entries.

per_page:

This is a deprecated argument.

Returns:

A list of JSONs of tags in Action Network.

get_tag(tag_id)[source]
Args:
tag_id:

Id of the tag.

Returns:

A JSON of the entry. If the entry doesn’t exist, Action Network returns “{‘error’: ‘Couldn’t find tag with id = <id>’}”

add_tag(name)[source]
Args:
name:

The tag’s name. This is the ONLY editable field

Adds a tag to Action Network. Once created, tags CANNOT be edited or deleted.

get_taggings(tag_id, limit=None, per_page=25, page=None, filter=None)[source]
Args:
tag_id:

The unique id of the tag

limit:

The number of entries to return. When None, returns all entries.

per_page:

The number of entries per page to return. 25 maximum.

page:

Which page of results to return

filter:

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all the tagging entries associated with the tag_id

get_tagging(tag_id, tagging_id)[source]
Args:
tag_id:

The unique id of the tag

tagging_id:

The unique id of the tagging

Returns:

A JSON with the tagging entry

get_wrappers(limit=None, per_page=25, page=None, filter=None)[source]
Args:
limit:

The number of entries to return. When None, returns all entries.

per_page:

The number of entries per page to return. 25 maximum.

page:

Which page of results to return

filter:

The OData query for filtering results. E.g. “modified_date gt ‘2014-03-25’”. When None, no filter is applied.

Returns:

A JSON with all the wrapper entries

get_wrapper(wrapper_id)[source]
Args:
wrapper_id:

The unique id of the wrapper

tagging_id:

The unique id of the tagging

Returns:

A JSON with the wrapper entry