Skip to main content
Skip table of contents

Create a Callout Integration Setting Apex Class

Developers can create an integration setting Apex class to handle requests and responses from a third-party API. The Apex class is used by an outbound integration setting to call the third-party API.

  1. In a sandbox org, from Setup, enter Apex Classes in the Quick Find box, then select Apex Classes.
  2. Click New.
  3. In Apex Class, enter:

    JAVA
    public with sharing class [InsertClassNameHere] implements NUINT.IIntegrationCallout {
        public CalloutBuildContext buildRequest(CalloutBuildContext context) {}
        public CalloutResponse makeCallout() {}
        public void handleResponses(List<Integration_Callout__c> callouts) {}
    }
    1. Replace[InsertClassNameHere] with the name you want to assign to the Apex class. 

  4. Update the Apex class to meet integration requirements:

    • The buildRequest method implements the functionality to build the required HttpRequest (external) and returns the request body in the CalloutBuildContext.Request. The CalloutBuildContext.Request is saved to Request on the integration callout. 
      The CalloutBuildContext references the integration setting on the CalloutBuildContext.IntegrationId.
    • The makeCallout method sends the HttpRequest (external) built by the buildRequest method and returns the HttpResponse (external) body in the CalloutResponse.Response. The CalloutResponse.Response is saved to Response on the integration callout. 
      The CalloutBuildContext references the integration setting on the CalloutBuildContext.IntegrationId
    • The handleResponses method receives a list of integration callouts with a Status of "Pending." The functionality of this method is determined by the requirements of the integration. The handleResponses method updates the Status of the integration callout to Completed or Failed depending on the results of the execution. 
      This method also updates the Completed Time and Message on the integration callout. In most cases, this method will update, insert, upsert, or delete Salesforce and/or Nimble AMSrecords based on the response from the third-party API. Each integration callout has a lookup to the integration setting. 
  5. Click Save.

  6. Set the Class on the integration setting to the name of the newly created Apex class. 

  7. Create an Apex test class to test the functionality of the new Apex class. See Testing Best Practices (external) and Checking Code Coverage (external) to learn more.
  8. Send the integration setting Apex class and test Apex class to a production environment using a change set. See change sets (external) to learn more.
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.