Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MobileCommons Connector #896

Merged
merged 51 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
49468f6
mobilecommons class
cmdelrio Aug 11, 2022
bcaafa5
Update __init__.py
cmdelrio Aug 11, 2022
7433771
get broadcasts
cmdelrio Aug 11, 2022
8ec4625
fix get broadcast request
cmdelrio Aug 16, 2022
e48f628
Add mc_get_request method
cmdelrio Aug 17, 2022
6574c13
Add annotation
cmdelrio Aug 17, 2022
33a395f
Incorporate Daniel's suggestions and finish up get_broadcasts
cmdelrio Sep 16, 2022
f92a1c6
A few more methods
cmdelrio Sep 16, 2022
1c363a9
small fix
cmdelrio Sep 16, 2022
7454d6a
Remove page_count, use page record num instead
cmdelrio Mar 14, 2023
b9dbb1b
Add in page_count again
cmdelrio Mar 14, 2023
e0ab6f5
Fix logging numbers
cmdelrio Mar 14, 2023
4853b19
Add create_profile
cmdelrio Mar 14, 2023
7913d8f
Fix error message for post request
cmdelrio Mar 14, 2023
9b65a93
Start tests
cmdelrio Jun 29, 2023
db6c3a2
Add some tests
cmdelrio Jun 29, 2023
20528e0
Continue testing
cmdelrio Jun 29, 2023
64e64b7
Update test_mobilecommons.py
cmdelrio Aug 15, 2023
cc3c44c
functionalize status_code check
cmdelrio Aug 15, 2023
9798e57
break out parse_get_request function
cmdelrio Aug 25, 2023
d10ecfe
fix test data
cmdelrio Aug 25, 2023
839db6d
fix documentation typo
cmdelrio Aug 25, 2023
f510040
Add several tests
cmdelrio Aug 25, 2023
a563306
Update mobilecommons.py
cmdelrio Sep 22, 2023
b5e029b
Fix limit and pagination logic
cmdelrio Sep 22, 2023
7e2872c
debug unit testing
cmdelrio Sep 22, 2023
d720fa5
better commenting and logic
cmdelrio Sep 22, 2023
5d3fea0
Documentation
cmdelrio Sep 26, 2023
493e117
Add MC to init file
cmdelrio Sep 26, 2023
cad250f
Merge branch 'main' into cormac-mobilecommons-connector
cmdelrio Sep 26, 2023
8190052
Revert "Merge branch 'main' into cormac-mobilecommons-connector"
cmdelrio Sep 26, 2023
8f87ec2
Revert "Add MC to init file"
cmdelrio Sep 26, 2023
9e1d6d5
Revert "Revert "Add MC to init file""
cmdelrio Sep 26, 2023
18b0732
Revert "Revert "Merge branch 'main' into cormac-mobilecommons-connect…
cmdelrio Sep 26, 2023
e6cbe2c
Fix init destruction
cmdelrio Sep 26, 2023
d572a91
fix init yet again
cmdelrio Sep 26, 2023
2034f48
Update testing docs with underscores
cmdelrio Sep 26, 2023
a058912
Merge branch 'cormac-mobilecommons-connector' of https://github.com/m…
cmdelrio Sep 26, 2023
81dd8f5
Lint
cmdelrio Sep 26, 2023
785157b
Lint tests
cmdelrio Sep 26, 2023
012b159
break up long responses
cmdelrio Sep 26, 2023
6d224a7
Fix more linting issues
cmdelrio Sep 26, 2023
5aab418
Hopefully last linting issue
cmdelrio Sep 27, 2023
415eaee
DGJKSNCHIVBN
cmdelrio Sep 27, 2023
9fdc7cf
Merge branch 'main' into cormac-mobilecommons-connector
sharinetmc Oct 3, 2023
075432b
Documentation fixes
cmdelrio Oct 17, 2023
3b012ba
Merge branch 'cormac-mobilecommons-connector' of https://github.com/m…
cmdelrio Oct 17, 2023
aa87a80
Remove note to self
cmdelrio Oct 17, 2023
6b098ba
date format
cmdelrio Oct 17, 2023
908e7b4
remove random notes
cmdelrio Oct 17, 2023
b727e1a
Update test_mobilecommons.py
cmdelrio Oct 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
hustle
mailchimp
mobilize_america
mobilecommons
shaunagm marked this conversation as resolved.
Show resolved Hide resolved
nation_builder
newmode
ngpvan
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(MOBILECOMMONS_USERNAME='octavia.b@scifi.net', MOBILECOMMONS_PASSWORD='badpassword123')
shaunagm marked this conversation as resolved.
Show resolved Hide resolved

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you confirm that these autodocs build for you locally? For some reason they're not building for me, and after 20 minutes debugging I have not figured out why. If they work for you, I'll chalk it up to git ghosts - if not, we can debug together.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They did build for me!

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