Phone2Action

Phone2Action is a digital advocacy tool used by progressive organizations. This class allows you to interact with the tool by leveraging their API.

class parsons.Phone2Action(app_id=None, app_key=None)[source]

Instantiate Phone2Action Class

Args:
app_id: str

The Phone2Action provided application id. Not required if PHONE2ACTION_APP_ID env variable set.

app_key: str

The Phone2Action provided application key. Not required if PHONE2ACTION_APP_KEY env variable set.

Returns:

Phone2Action Class

get_advocates(state=None, campaign_id=None, updated_since=None, page=None)[source]

Return advocates (person records).

If no page is specified, the method will automatically paginate through the available advocates.

Args:
state: str

Filter by US postal abbreviation for a state or territory e.g., “CA” “NY” or “DC”

campaign_id: int

Filter to specific campaign

updated_since: str

Fetch all advocates updated since UTC date time provided using (ex. ‘2014-01-05 23:59:43’)

page: int

Page number of data to fetch; if this is specified, call will only return one page.

Returns:
A dict of parsons tables:
  • emails

  • phones

  • memberships

  • tags

  • ids

  • fields

  • advocates

get_campaigns(state=None, zip=None, include_generic=False, include_private=False, include_content=True)[source]

Returns a list of campaigns

Args:
state: str

Filter by US postal abbreviation for a state or territory e.g., “CA” “NY” or “DC”

zip: int

Filter by 5 digit zip code

include_generic: boolean

When filtering by state or ZIP code, include unrestricted campaigns

include_private: boolean

If true, will include private campaigns in results

include_content: boolean

If true, include campaign content fields, which may vary. This may cause sync errors.

Returns:
Parsons Table

See Parsons Table for output options.