Interacting With Mobile Commons on the Web

Mobile Commons provides a simple HTTP POST interface to enable your users to opt-in to mobile campaign(s), donate money and more from the web.

Overview
Sample Form
Form Parameters
Opt Outs

Mobile Commons provides a single, multi-purpose web form that can handle multiple actions. Currently, we support opting into one or more campaigns, triggering a phone call, accepting a mobile donation, or inviting friends from a single form.

 

Form Actions

First, let's just look at a sample form because that will be enough for most developers to be on their way:

    <form action="http://default.mcommons.com/profiles/join" method="POST">
      <input type="hidden" name="redirect_to" value="http://mobilecommons.com/redirect_to_instructions" />
      <label>First name:<br /><input type="text" name="person[first_name]" /></label><br />
      <label>Last name:<br /><input type="text" name="person[last_name]" /></label><br />
      <label>Email:<br /><input type="text" name="person[email]" /></label><br />
      <label>Postal code:<br /><input type="text" name="person[postal_code]" /></label><br />
      <label>Mobile:<br /><input type="text" name="person[phone]" /></label><br />
      
      <input type="checkbox" name="opt_in_path[]" value="1" checked="true">Sign up for SMS Alerts<br>
      <input type="checkbox" name="opt_in_path[]" value="2" checked="true">Sign up for SMS Coupons<br>
      <input type="checkbox" name="fundraising" value="3" checked="true">Donate $5<br>
      <input type="checkbox" name="mconnect" value="4" checked="true">Call Me Now<br>

      <label>Invite a Friend:<br /><input type="text" name="friends[]"/></label><br />
      <input type="hidden" name="friends_opt_in_path" value="5" />
	  

      <input type="submit" value="Submit" />
    </form>
    <a href="http://mobilecommons.com/terms" style="font-size:75%">Msg & Data Rates May Apply</a>
    Text <b>STOP</b> to opt-out or <b>HELP</b> for help. Expect 3 msgs/mo.
  

To use this form, simply change the values in red for the logic you need, then paste it into your HTML page.

 

Parameters and Variables

To specify the desired actions, you should include one or more of the following parameters:

The value(s) associated with each parameter can be found in your mcommons URL. For example, http://you.mcommons.com/fundraising/123 would have a value of '123'.

Currently, Mobile Commons allows mapping to things that are recognized as attributes of profiles within our system. As per the code example above, the form field names should have values that correspond to the general scheme person[attribute]. The values which we currently recognize are:

If you are using any custom fields, simply place the name of the column in the form like so:

If you have a CRM integration setup, you can send us the constituent's ID from your database

 

POST Opt-Outs

Opt-outs happen at a higher level than individual campaigns, they happen at the company or organization level. To create an opt-out form, the following code can serve as a guide:


    <form action="http://default.mcommons.com/profiles/opt_out" method="post">
      <input type="hidden" name="redirect_to" value="http://www.yoursite.com/mobile_optout.html" />
      <input type="hidden" name="company_id" value="123" />
      <label>Mobile:<br /><input type="text" name="person[phone]" /></label><br />

      <input type="submit" value="Opt-Out" />
    </form>
  

You MUST use your sub-domain in place of the default in default.mcommons.com and you MUST replace the company_id field 123 with your company's ID

. You can find your company's ID from the Setup tab.