MobileCommons - Civis Integration
The MobileCommons integration in Platform allows users to import data from MobileCommons into a Civis table and export data from Platform into MobileCommons. This integration uses the MobileCommons API. Generally, each resource in the integration corresponds with an endpoint in the MobileCommons API.
You can create a script here, or in Platform navigate to Code -> Scripts -> More Script Templates and searching for "MobileCommons to Civis" or "11047". If you are not shared on this template, please email support@civisanalytics.com.
MobileCommons to Civis Import
Script Template
The MobileCommons to Civis import script runs as a templated script in the Civis Platform. The script accepts the following parameters:
MOBILECOMMONS (required)
The user's MobileCommons API key saved in Platform as a Civis custom credential. Different from the Company Key (below).
Mobilecommons currently supports both username/password login and API key login. After March 31st, 2025 MobileCommons will no longer allow users to use username and password combinations for authentication.
If authenticating via API key or migrating from a username/password credential:
- First, generate a Mobile Commons API key. The new Upland Credential Manager should be enabled for your Mobile Commons account. Then generate an API key in your Mobile Commons interface (Profile -> Company & Users -> Edit User -> Generate New Key). If you have questions or need support for obtaining an API key, please reach out to the Mobile Commons team.
- Create a new Civis Platform credential to store this API key. The credential type is “custom”. The password is the API key you’ve just obtained from Mobile Commons. The username must be “APIKEY” (without quotes, and no spaces, no hyphens). We recommend naming this credential “Mobile Commons API key” or something similar to distinguish it from your other Mobile Commons credential with username/password.
- Update all your Mobile Commons scripts on Civis Platform to use this new credential.
If authenticating via username/password:
- Create a custom Civis Platform credential where the username field is your MobileCommons login and the password is your MobileCommons password.
- Select the newly created credential from the dropdown menu on the custom script.
RESOURCES (required)
The MobileCommons resource to import. One of mconnects, campaigns, keywords, groups, profiles, tinyurls, tags, attachments, mdatas, subscribers, incoming, outgoing, broadcasts, calls, mdata_entries, mdata_queries, group_members. A detailed description of each resource is provided below (Mobile Commons Import Resources).
FILTER_IDS
Optional list of resource ID’s to filter for. This only applies to child resources, i.e. resources that are queried by a parent object, e.g. subscribers, incoming, outgoing, broadcasts, calls, mdata_entries, mdata_queries, group_members. For example, enter 12345 to query for all group members from parent group ID 12345.
COMPANY
An optional string identifying the company within MobileCommons. Will be used to authorize the credential passed.
CLUSTER (required)
The cluster to import MobileCommons data into.
CLUSTER_CREDENTIAL (required)
A valid credential for the Platform cluster chosen.
SCHEMA (required)
The schema in which to store data from MobileCommons. The table name will be based on the MobileCommons resource name.
TABLENAME_PREFIX
Optional string to prefix each table name in Platform.
TABLENAME_SUFFIX
Optional string to append to each table name in Platform.
EXISTING_TABLE_ROWS (required)
One of drop, append, truncate, merge. Will determine how existing table rows in the Civis Platform will be handled when running additional syncs.
START_TIME
Timestamp of the form 2017-01-01 00:00:00 UTC, the start date and time of data to query. One of START_TIME or DAYS is required.
END_TIME
Optional timestamp of the form 2017-01-01 00:00:00 UTC, the end date and time of data to query. Defaults to the current timestamp.
DAYS
Integer number of days to run the sync. One of START_TIME or DAYS is required.
BATCH_SIZE
Optional integer will determine how many records of data to store in memory before syncing. Can be used to increase the run time by reducing the number of table syncs that occur.
PER_PAGE
Optional integer will determine how many records per page to request from the MobileCommons API. Must be between 1 and 1000. Defaults to 500.
LOG_LEVEL
String depicting the severity level of logging to report to job run logs. Defaults to WARNING. The log levels available are:
- DEBUG - the most verbose logging level, will log all notifications.
- INFO - Logs notifications info level notifications or higher.
- WARNING - Logs notifications at the warning level or higher.
- ERROR - Logs only errors or higher.
- CRITICAL - Logs only the most critical errors.
ALL_FIELDS
Boolean, set to TRUE to return all fields provided by the MobileCommons API. Set to FALSE to return only legacy integration fields.
ASYNC
Integer between 1 and 10, sets the level of concurrency of calls to the MobileCommons API. Defaults to 10. Setting async_workers to 1 is the most stable setting.
Objects in MobileCommons can be descendants of other objects. For example, a campaign subscriber belongs to a campaign object, and in order to return all campaign subscribers in an organization all campaigns must be queried. When running an import on a resource that relies on parent elements to search, the runtime of the script may be improved by running the script in ASYNC mode. In ASYNC mode the script will make up to 10 API calls in parallel across the parent objects. Resources that can benefit from ASYNC mode are subscribers, incoming messages, outgoing messages, broadcasts, calls, mData entries, mData queries, and group members.
MobileCommons Import Resources
The following resources and fields are available for importing data from MobileCommons to the Civis Platform:
MConnects
- mconnect_id - integer
- active - boolean
- name - string
- destination_number - string
- destination_description - string
- voip_number - string
- call_type - string
- autoroute - boolean
- subscriber_follow_up - string
- nonsubscriber_follow_up - string
- call_timeout - integer
- failover_number - integer
- failover_text - string
- voicemail - boolean
- transcribe - boolean
- shortcode - integer
- run_date - string
Campaigns
- campaign_id - integer
- active - boolean
- name - string
- description - string
- run_date - string
The following is a subset of the Campaigns resource and can be brought in by selecting Campaigns as the resource to import:
Opt In Paths
- opt_in_path_id - integer
- active - boolean
- name - string
- campaign_id - integer
- run_date - string
Keywords
- keyword_id - integer
- active - boolean
- name - string
- opt_in_path_id - integer
- ended_at - string
- created_at - string
- updated_at - string
- run_date - string
Groups
- group_id - integer
- type - string
- status - string
- name - string
- size - integer
- run_date - string
Profiles
- profile_id - integer
- first_name - string
- last_name - string
- phone_number - string
- email - string
- status - string
- created_at - string
- updated_at - string
- opted_out_at - string
- opted_out_source - string
- source_type - string
- source_name - string
- source_id - integer
- source_opt_in_path_id - integer
- source_message_id - integer
- address_street1 - string
- address_street2 - string
- address_city - string
- address_state - string
- address_postal_code - string
- address_country - string
- last_saved_location_latitude - double
- last_saved_location_longitude - double
- last_saved_location_precision - string
- last_saved_location_city - string
- last_saved_location_state - string
- last_saved_location_postal_code - string
- last_saved_location_country - string
- last_saved_districts_congressional_district - string
- last_saved_districts_state_upper_district - string
- last_saved_districts_state_lower_district - string
- last_saved_districts_split_district - string
- run_date - string
The following are subsets of the Profiles resource and can be brought in by selecting Profiles as the resource to import:
Customs
- name - string
- profile_id - integer
- hash_id - string
- created_at - string
- updated_at - string
- value - string
- run_date - string
Integrations
- constituent_id - integer
- type - string
- synchronized_at - string
- profile_id - integer
- hash_id - string
- run_date - string
Clicks
- click_id - integer
- created_at - string
- url - string
- remote_addr - string
- http_referer - string
- user_agent - string
- profile_id - integer
- hash_id - string
- run_date - string
Subscriptions
- campaign_id - integer
- campaign_name - string
- campaign_description - string
- opt_in_path_id - integer
- status - string
- opt_in_source - string
- created_at - string
- activated_at - string
- opted_out_at - string
- opt_out_source - string
- profile_id - integer
- hash_id - string
- run_date - string
Tinyurls
- tinyurl_id - integer
- created_at - string
- name - string
- mode - string
- url - string
- host - string
- description - string
- key - string
- run_date - string
Tags
- tag_id - integer
- name - string
- run_date - string
Taggable
- taggable_id - integer
- type - string
- tag_id - integer
- run_date - string
Attachments
- attachment_id - integer
- name - string
- thumbnail_link - string
- run_date - string
Mdatas
- mdata_id - integer
- name - string
- type - string
- uuid - string
- run_date - string
Subscribers
- subscription_id - integer
- profile_id - integer
- phone_number - integer
- activated_at - string
- opted_out_at - string
- run_date - string
- campaign_id - integer
- opt_in_path_id - integer
Incoming
- message_id - integer
- type - string
- approved - boolean
- phone_number - integer
- carrier_name - string
- profile - integer
- body - string
- message_template_id - integer
- keyword - string
- received_at - string
- previous_id_id - integer
- campaign_id - integer
- campaign_active - boolean
- campaign_name - string
- next_id_id - integer
- keyword_id - integer
- keyword_name - string
- keyword_opt_in_path_id - integer
- run_date - string
Outgoing
- message_id - integer
- type - string
- status - string
- phone_number - integer
- profile - integer
- broadcast_id - integer
- body - string
- sent_at - string
- message_template_id - integer
- campaign_id - integer
- campaign_active - boolean
- campaign_name - string
- previous_id_id - integer
- next_id_id - integer
- run_date - string
Broadcasts
- broadcast_id - integer
- status - string
- name - string
- body - string
- delivery_time - string
- include_subscribers - boolean
- throttled - boolean
- localtime - boolean
- automated - boolean
- estimated_recipients_count - integer
- replies_count - integer
- opt_outs_count - integer
- campaign_id - integer
- campaign_active - boolean
- campaign_name - string
- run_date - string
The following are subsets of the Broadcasts resource and can be brought in by selecting Broadcasts as the resource to import:
Broadcast_included_groups
- name - string
- group_id - integer
- type - string
- broadcast_id - integer
- hash_id - string
- run_date - string
- campaign_id - integer
Broadcast_excluded_groups
- broadcast_id - integer
- name - string
- group_id - integer
- type - string
- hash_id - string
- run_date - string
- campaign_id - integer
Calls
- call_id - integer
- start_time - string
- end_time - string
- duration - integer
- call_status - string
- connection_source - string
- email - string
- profile_status - string
- profile_status_at_call_time - string
- handset_number - integer
- carrier_name - string
- voip_number - integer
- destination_number - integer
- transcription - string
- voicemail_duration - integer
- voicemail - string
- mconnect_id - integer
- profile_id - integer
- run_date - string
- legislator_first_name - string
- legislator_last_name - string
- legislator_party - string
- legislator_district - string
- legislator_state - string
MData_queries
- created_at - string
- keyword - string
- input - string
- output - string
- result - string
- error_log_body - string
- query_location_street1 - string
- query_location_city - string
- query_location_state - string
- query_location_postal_code - string
- query_location_country - string
- query_location_latitude - double
- query_location_longitude - double
- query_location_map - string
- profile_status - string
- profile_email - string
- profile_first_name - string
- profile_last_name - string
- profile_source_type - string
- profile_source_name - string
- profile_phone_phone_number - integer
- profile_phone_carrier_name - string
- profile_address_street1 - string
- profile_address_street2 - string
- profile_address_city - string
- profile_address_state - string
- profile_address_postal_code - string
- profile_address_country - string
- profile_address_latitude - double
- profile_address_longitude - double
- profile_address_geocoded_city - string
- profile_address_geocoded_state - string
- profile_address_geocoded_postal_code - string
- profile_address_geocoded_country - string
- profile_custom_columns_custom_column - string
- run_date - string
- mdata_id - integer
Group_members
- profile_id - integer
- first_name - string
- last_name - string
- phone_number - integer
- email - string
- status - string
- created_at - string
- updated_at - string
- opted_out_at - string
- opted_out_source - string
- clicks - string
- source_type - string
- source_name - string
- source_id - integer
- source_opt_in_path_id - integer
- source_message_id - integer
- address_street1 - string
- address_street2 - string
- address_city - string
- address_state - string
- address_postal_code - string
- address_country - string
- last_saved_location_latitude - double
- last_saved_location_longitude - double
- last_saved_location_precision - string
- last_saved_location_city - string
- last_saved_location_state - string
- last_saved_location_postal_code - integer
- last_saved_location_country - string
- last_saved_districts_congressional_district - string
- last_saved_districts_state_upper_district - string
- last_saved_districts_state_lower_district - string
- last_saved_districts_split_district - string
- custom_columns_custom_column - string
- subscriptions_subscription_campaign_id - integer
- subscriptions_subscription_campaign_name - string
- subscriptions_subscription_campaign_description - string
- subscriptions_subscription_opt_in_path_id - integer
- subscriptions_subscription_status - string
- subscriptions_subscription_opt_in_source - string
- subscriptions_subscription_created_at - string
- subscriptions_subscription_activated_at - string
- subscriptions_subscription_opted_out_at - string
- subscriptions_subscription_opt_out_source - string
- hash_id - string
- run_date - string
- group_id - integer
Comments
0 comments
Please sign in to leave a comment.