Mobile Commons¶
The MobileCommons class leverages the API of Upland Mobile (nee Mobile Commons).
Campaigns¶
- class parsons.mobile_commons.mobile_commons.Campaigns(mc_connection)[source]¶
Class for campaigns endpoints.
- campaigns(include_opt_in_paths=0, sort='asc', status=None, campaign_id=None)[source]¶
Return a list of campaigns.
- Args:
- include_opt_in_paths: int
Set to 1 to include all opt-in path details. Default is 0.
- sort: str
Set to asc or desc to sort by campaign ID ascending or descending. Default is ascending.
- status: str
Set to active or ended to filter results. Default is empty and returns all campaigns.
- campaign_id: str
Provide a specific campaign ID to view single result, invalid campaign ID will return all campaigns.
- Returns:
- Parsons Table
See Parsons Table for output options.
- campaign(campaign_id, include_opt_in_paths=0)[source]¶
Return a single campaign.
- Args:
- campaign_id: str
Provide a specific campaign ID to view single result, invalid campaign ID will return all campaigns.
- include_opt_in_paths: int
Set to 1 to include all opt-in path details. Default is 0.
- Returns:
- Parsons Table
See Parsons Table for output options.
Groups¶
- class parsons.mobile_commons.mobile_commons.Groups(mc_connection)[source]¶
Class for groups endpoints.
- groups()[source]¶
Return a list of groups.
- Returns:
- Parsons Table
See Parsons Table for output options.
- group_members(group_id, limit=None, page=None, from_date=None, to_date=None)[source]¶
Return a list of members in a group.
- Args:
- group_id: int
Required; The primary key of the group.
- limit: int
Optional; Limits the number of returned profiles. Maximum of 1000.
- page: int
Optional; Specifies which page, of the total number of pages of results, to return.
- from_date: str
Optional; Limits the returned profiles to ones updated after or on this date time. ISO-8601 format.
- to_date: str
Optional; Limits the returned profiles to ones updated before or on this date time. ISO-8601 format.
- Returns:
- Parsons Table
See Parsons Table for output options.
- group_create(name)[source]¶
Create a group.
- Args:
- name: str
Required; The name for the new group.
- Returns:
- Parsons Table
See Parsons Table for output options.
- group_add_members(group_id, phone_numbers)[source]¶
Add a list of members to a group.
- Args:
- group_id: int
Required; The primary key of the group.
- phone_numbers: list
Required; A list of phone numbers to add to the group. If the phone numbers don’t exist, the will be created as new profiles.
- Returns:
- Parsons Table
See Parsons Table for output options.
- group_remove_members(group_id, phone_number)[source]¶
Remove a list of members from a group.
- Args:
- group_id: int
Required; The primary key of the group.
- phone_number: list
Required; A list of phone numbers to remove from the group. If the phone number is not a member of the group, it will still return the group.
- Returns:
- Parsons Table
See Parsons Table for output options.
Profiles¶
- class parsons.mobile_commons.mobile_commons.Profiles(mc_connection)[source]¶
Class for profiles endpoints.
- profiles(phone_number=None, from_date=None, to_date=None, limit=None, page=None, include_custom_columns=None, include_subscriptions=None, include_clicks=None, include_members=None)[source]¶
Return a list of profiles.
- Args:
- phone_number: list
Optional; Limits the returned profiles matching the provided phone numbers. Phone numbers should be specified with country code.
- from_date: str
Optional; Limits the returned profiles to ones updated after or on this date time. ISO-8601 format
- to_date: str
Optional; Limits the returned profiles to ones updated before or on this date time. ISO-8601 forma
- limit: int
Optional; Limits the number of returned profiles. Maximum of 1000
- page: int
Optional; Specifies which page, of the total number of pages of results, to return
- include_custom_columns: boolean
Optional; Optional default ‘true’ - allows exclusion of custom columns associated with profiles, pass ‘false’ to limit
- include_subscriptions: boolean
Optional; Optional default ‘true’ - allows exclusion of subscriptions for each profile, pass ‘false’ to limit
- include_clicks: boolean
Optional; Optional default ‘true’ - allows exclusion of clicks
- include_members: boolean
Optional; Optional default ‘true’ - allows exclusion of profile member records maintained for integrations
- Returns:
- Parsons Table
See Parsons Table for output options.
- profile_get(phone_number, company=None, include_messages=False, include_donations=False)[source]¶
Return a single profile record.
- Args:
- phone_number: str
Required; The phone number for the profile to return.
- company: str
Optional; If different that the one specified for the connection. Default is the firm.
- include_messages: boolean
Optional; Set to true to include associated text messages. Default is false.
- include_donations: boolean
Optional; Set to true to include associated mobile giving donations, if any. Default is false.
- Returns:
- Parsons Table
See Parsons Table for output options.
- profile_update(phone_number, email=None, postal_code=None, first_name=None, last_name=None, street1=None, street2=None, city=None, state=None, country=None, custom_fields={}, opt_in_path_id=None)[source]¶
Create or update a profile.
- Args:
- phone_number: str
Required; The phone number for the profile to update.
- email: str
Optional; New email for the profile.
- postal_code: str
Optional; New postal code for the profile.
- first_name: str
Optional; New firstname for the profile.
- last_name: str
Optional; New lastname for the profile.
- street1: str
Optional; New street1 for the profile.
- street2: str
Optional; New street2 for the profile.
- city: str
Optional; New city for the profile.
- state: str
Optional; New state for the profile.
- country: str
Optional; New country for the profile.
- custom_fields: dict
Optional; A dict of custom fields and their new values for the profile.
- opt_in_path_id: str
Optional; New opt_in_path_id for the profile.
- Returns:
- Parsons Table
See Parsons Table for output options.
- profile_opt_out(phone_number, campaign_id=None, subscription_id=None)[source]¶
Opt out a profile from a campaign, subscription or all.
- Args:
- phone_number: str
Required; The phone number for the profile to opt out.
- campaign_id: int
Optional; Opt-out this campaign only. Default is all campaigns.
- subscription_id:int
Optional; Opt-out this subscription only. Default is all subscriptions.
- Returns:
- Parsons Table
See Parsons Table for output options.