The Litify Intakes API allows your firm’s marketing partners to easily post new intakes to Litify. Create intakes and populate any available standard and custom field on the intake. Link case results directly to your lead generation programs and specific marketing efforts. 

This document walks you through how to set up your Litify Intakes API. 

Set up a Force.com Site

Create a new Force.com Site. This is the site you and your partners will use to post new Intakes to Litify.

  1. Follow the steps outlined in Salesforce Documentation to create a new Site
  2. If not already enabled, register a Site subdomain. You can't modify your Force.com domain name after you have registered it.
    • Click New to create a new site
    • Site Label: Intake API
    • Active Site Home: AnswersHome (or any blank Visualforce page)
    • Default Web Address: api
    • Check the box: Require Secure Connection (HTTPS)

      Tip: Be sure to use the secure (https) version of the site URL.
  3. Activate Site

Screenshot_2017-05-16_14.17.23.png

Screenshot_2017-05-16_14.35.42.png

Configure Public Access Settings for the site

You must set up the correct Public Access Settings for the site. These settings control the activities public users can do on your site. You must grant users the ability to use IntakeRestAPI in order for intakes to post to Litify.


  1. Navigate to Setup > Sites > Intakes API > Public Access Settings
    rtaImage.gif
  2. Enable Apex Class Access for litify_pm.IntakeRestAPI
    Screenshot_2017-05-16_14.38.11.png
  3. Update Object Permissions: 
    • ​Accounts: READ, CREATE
    • Contacts: READ, CREATE
    • Intakes: READ, CREATE, EDIT
    • Sources: READ
    • Case Types: READ
  4. Enable Custom Permissions:
    • Litify Permission Insert Account
    • Litify Permission Update Account
    • Litify Permission Insert Contact
    • Litify Permission Update Contact 

Configure available fields with Custom Metadata Types

You must configure the Custom Metadata Type related to the Intakes API to set up which values map to which fields when you post intakes. We include some fields by default, and you can add any standard or custom intake or account field you want to send with your intakes. View available Salesforce field types for formatting details.  

  1. Search for "Custom Metadata Types" in Salesforce Setup
  2. Click Manage Records for Intake Mapper
  3. ​Click New to add a new field. You can choose any intake or party field
    • Label/Intake Mapper Name would be the name of the field in the JSON request. Example: firstName
    • SObject Name is the name of the destination object in a Salesforce org (account or intake)
    • Field Name is the name of the field in the destination object in a Salesforce org 

Sending Intakes via API from an external system

NOTE REGARDING DUPLICATES: We have a built-in duplicate check for submissions that have the same email address as existing party records. If there is a matching account in your system when you post a new entry, it will upsert that record instead of creating a new record.

Provide a copy of the sample JSON request to your developer.

For example, the initial setup has the following request body and parameters:

Formats Supported: JSON

End Point:

https://***YOURSITEURL***.secure.force.com/api/services/apexrest/litify_pm/api/v1/intake/create
  • Make sure to include your site URL without asterisks in the above end point. It's important that your URL matches this exactly or you will encounter errors.

Headers: Content-Type:Application/JSON

Method: POST

Body (Note: your format must follow the below JSON exactly or else you will see errors):

{  
 "firstName" : "tester",
 "lastName" : "last tester 1",
 "email": "test@test.com",
 "phone" : "222-222-1122",
 "websource" : "Website",
 "intakeStatus": "Working",
 "caseType" : "Warranty"
}

When we add other fields, we simply need to add labels of the Intake Mapper to the JSON and sample output.

{  
 "firstName" : "tester",
 "lastName" : "last tester 1",
 "email": "test@test.com",
 "phone" : "222-222-1122",
 "websource" : "Website",
 "intakeStatus": "Working",
 "caseType" : "Warranty",
 "myOtherCustomField1" : "sampleValueText",
 "myOtherCustomField2" : 11.2,
 "dateField" : "12/05/2017",
 "dateTimeField" : "10/14/2011 11:46 AM",
 "booleanField" : true,
 "booleanField" : false
}

Examples of Dates and DateTime values

"dateField": "12/05/2017",

"dateTimeField" : "10/14/2011, 11:46 AM"

Note: With the Salesforce Winter '21 update, and subsequent Matters + Intakes v22.7 update, the DateTime field requires a comma after the date value.

Note: Date-time values are interpreted as being in an org's default timezone. Submitting it in a timestamp format referencing the timezone causes an error. Example: “Timestamp”: “2018-01-08T10:53:08-05:00." At present, we are not able to account for timezones. We are working on this.

Note: Websource and caseType fields are provided with the package and mapped automatically in the API code. Those fields are being matched based on the records in your salesforce organization. If you don’t have a record corresponding to the value sent in JSON request, that field is left blank on the newly created Intake.

Was this article helpful?
2 out of 3 found this helpful