Developer Guide – v1

URLs | Authentication | Objects | Results | Error Codes  

API URLs

Any API endpoint can be accessed with either HTTP GET or POST. Objects that are associated with a phone number require the phone number as part of the URL, which must be expressed in international format (i.e. “+13305551212”).

Objects that require a phone number use this URL scheme:

https://app.mojotxt.com/api/v1/{phone_number}/{object}/{verb}/{parameter}
Objects that do not require a phone number, use this URL scheme:
https://app.mojotxt.com/api/v1/{object}/{verb}/{parameter}

Authentication

Visit the Software Integration page of your account to generate your MojoTxt API credentials. Once you have obtained your API credentials, authenticate your requests with them using HTTP basic authentication.  

Objects

Object Description Requires Phone Number
phoneNumbers Work with MojoTxt phone numbers. No
subscribers Work with subscriber data. Optional
donations Work with donation keywords and download transactions. Yes
lists Work with subscription lists. Yes
messages Work with subscription list messages. Yes
messageLog Get a list of incoming/outgoing messages. Yes

Results

API results are returned in JSON format.

Example Successful API Call:

GET https://app.mojotxt.com/api/v1/+16146827117/donations/list?Sort=DonationID
{
“result":"success", /* Test for "success" to determine a successful result. */
“timestamp":1445803296, /* The server's current UNIX timestamp. */
“request”: /* The server will echo back all received parameters. */
{
“phone":"+16146827117", /* phone_number (sent in URL) */
“object":"donations", /* object (sent in URL) */
“verb":"list" /* verb (sent in URL) */
“Sort":"DonationID" /* Sort parameter (sent in querystring) */
},
“record_count":1, /* The number of records in this result set. */
“records”: [ /* An array containing the record(s) requested. */
{
"DonationID":103,
"Keyword":"give",
"FundName":"General Fund”,
"DefaultAmount":null,
"RecurringScheduleID":0,
"CCBFund":1
}
]
}

Example Unsuccessful API Call:

In this example, a DonationID is not included at the end of the URL.
GET https://app.mojotxt.com/api/v1/+16146827117/donations/get
{
   "result":"error",                                    /* "error" indicates a problem occured. */
   "error_code":1200,                                   /* the error code                       */
   "error_message":"No Donation object specified.",     /* a human-readable error message       */
   "timestamp":1445804872,                              /* the server's current UNIX timestamp  */
   "request":                                           /* all reveived parameters              */
      {     
         "phone":"+16146827117",
         "object":"donations",
         "verb":"get"
      }
}

Error Codes

Error Code Endpoint Description Notes
1000 API Core Not authenticated. Authenticate using your API Username & Password with HTTP digest authentication.
1001 API Core Authenication failed. Ensure your API Username and Password are correct.
1002 API Core No endpoint specified. You didn’t include an endpoint in your request. (i.e. /api/v1/+12225551212/donations/list)
1003 API Core Invalid endpoint. You included an endpoint, but it isn’t valid. See API documentation.
1004 API Core No verb specified. You didn't include a verb in your request (i.e. /api/v1/+12225551212/donations/list)
1005 API Core Invalid verb. You included a verb, but it isn’t valid. See API documentation.
1010 API Core Phone number not specified. You requested an API endpoint which requires a phone number, but you didn’t provide one. (i.e. /api/v1/+12225551212/donations/list)
1011 API Core Invalid phone number specified. The phone number you included in the request is either formatted incorrectly, or is not associated with your account. It should be in international format (i.e. +12223334444).
1012 API Core A database error occurred. Try again later. If problem persists, please contact us.
1050 All Invalid Sort parameter. The records can only be sorted by a field contained in the result object.
1051 All Invalid SortDirection. SortDirection must be “ASC” for ascending sort or “DESC” for descending sort.
1100 Keywords No keyword specified. Keyword parameter missing from POST or GET request.
1101 Keywords Invalid characters in keyword. Please use only letters and numbers (no spaces or special characters).
1102 Keywords Invalid keyword length. Your keyword must be between 1 and 20 characters in length.
1103 Keywords Reserved keyword. The keyword you entered is reserved for use by the system. (stop, cancel, unsubscribe, list, help)
1104 Keywords Keyword already exists. All keywords must be unique.
1105 Keywords Invalid keyword.
1200-1299 Donations (Multiple) See Donations Error Codes
1300-1399 Lists (Multiple) See Lists Error Codes
1400-1499 Messages (Multiple) See Messages Error Codes