Action Network

Action Network is an online tool for storing information about and organizing volunteers and donors. For more information, see Action Network developer docs

Quick Start

from parsons import ActionNetwork, Table

an = ActionNetwork(API_TOKEN)

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

# 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, api_url=None)[source]
Args:
api_token: str

The OSDI API token

api_url:

The end point url

get_people(limit=None, per_page=25, page=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

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>'}.

add_person(email_address, given_name=None, family_name=None, tags=[], languages_spoken=[], postal_addresses=[], **kwargs)[source]
Args:
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

tags:

Any 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/people#put

**kwargs:

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

Adds a person to Action Network

update_person(entry_id, **kwargs)[source]
Args:
entry_id:

The person’s Action Network id

**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

tags:

Any 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/people#put

custom_fields:

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

Updates a person’s data in Action Network

get_tags(limit=None, per_page=25, page=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

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.