Skip to content

Commit

Permalink
Merge branch 'main' into empower_connector
Browse files Browse the repository at this point in the history
  • Loading branch information
jburchard authored Oct 25, 2023
2 parents 082fa10 + 2f15a53 commit 8321f0b
Show file tree
Hide file tree
Showing 12 changed files with 906 additions and 17 deletions.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ Indices and tables
google
hustle
mailchimp
mobilecommons
mobilize_america
nation_builder
newmode
Expand Down
49 changes: 49 additions & 0 deletions docs/mobilecommons.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
MobileCommons
==========

********
Overview
********

`MobileCommons <https://secure.mcommons.com/>`_ is a broadcast text messaging tool that helps orgranizations
mobilize supporters and fundraise by building opt-ed in audiences. You can read more about the product
`here <https://uplandsoftware.com/mobile-messaging/>`_.

***********
Quick Start
***********

To instantiate a class you must pass the username and password of a MobileCommons account as an argument
or store the username and password into environmental variables called ``MOBILECOMMONS_USERNAME`` and
``MOBILECOMMONS_PASSWORD``, respectively. If you MobileCommons account has access to various MobileCommons
companies (i.e. organizations), you'll need to specify which MobileCommons company you'd like to interact
with by specifying the Company ID in the ``company_id`` parameter. To find the Company ID, navigate to the
`Company and Users page <https://secure.mcommons.com/companies/>`_.

.. code-block:: python
from parsons import MobileCommons
# Pass credentials via environmental variables for account has access to only one MobileCommons company
mc = MobileCommons()
# Pass credentials via environmental variables for account has access to multiple MobileCommons companies
mc = MobileCommons(company_id='EXAMPLE78363BOCA483954419EB70986A68888')
# Pass credentials via argument for account has access to only one MobileCommons company
mc = MobileCommons(username='[email protected]', password='badpassword123')
Then you can call various endpoints:

.. code-block:: python
# Return all MobileCommons subscribers in a table
subscribers = get_campaign_subscribers(campaign_id=1234567)
# Create a new profile, return profile_id
new_profile=create_profile(phone=3073991987, first_name='Jane', last_name='Fonda')
***
API
***
.. autoclass :: parsons.MobileCommons
:inherited-members:
1 change: 1 addition & 0 deletions parsons/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
("parsons.google.google_sheets", "GoogleSheets"),
("parsons.hustle.hustle", "Hustle"),
("parsons.mailchimp.mailchimp", "Mailchimp"),
("parsons.mobilecommons.mobilecommons", "MobileCommons"),
("parsons.mobilize_america.ma", "MobilizeAmerica"),
("parsons.nation_builder.nation_builder", "NationBuilder"),
("parsons.newmode.newmode", "Newmode"),
Expand Down
2 changes: 2 additions & 0 deletions parsons/airtable/airtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ def get_records(
See :ref:`parsons-table` for output options.
"""

if isinstance(fields, str):
fields = [fields]
# Raises an error if sort is None type. Thus, only adding if populated.
kwargs = {
"fields": fields,
Expand Down
3 changes: 3 additions & 0 deletions parsons/mobilecommons/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from parsons.mobilecommons.mobilecommons import MobileCommons

__all__ = ["MobileCommons"]
Loading

0 comments on commit 8321f0b

Please sign in to comment.