PrecisionLender API V2 Powers

Overview

When writing your skills, you may need to access data made available from the PrecisionLender API endpoints. The PrecisionLender API powers in Andi® allows you to access this data, but requires that your instance of PrecisionLender be set up to use the API and that your account has the required service username and tokens. With the API V2 Powers, you can get opportunity response and relationship response data via PrecisionLender's V2 API without the service username and tokens. For other PrecisionLender V2 API endpoints, you will still need to use the PrecisionLender API powers.

 

In this Article

 

What are the PrecisionLender API V2 Powers?

The PrecisionLender API V2 Powers allows you to return a promise using the 'get' method with the opportunityId parameter for the opportunity response and the relationshipId parameter for the relationship response (the defined parameters in the PrecisionLender API documentation). 

Opportunity

  • getOpportunityResponse (opportunityId: string) - returns the opportunity response model for a single, saved opportunity. For more information, see GetOpportunity API Documentation
  • getOpportunityRelationshipImpactResponse (opportunityId: string) - returns the relationship impact financial statement for a single, saved opportunity with an attached relationship. For more information, see GetOpportunityRelationshipImpact API Documentation

Relationship

  • getRelationshipSummaryResponse (relationshipId: string) - returns the relationship summary for a single relationship. This does not include account level data (ie loan and deposit level). For more information, see GetRelationshipSummary API Documentation.
  • getRelationshipAccountSummariesResponse (relationshipId: string) - returns the account level financial summary data for a single relationship. The summary is grouped by product. For more information, see GetRelationshipAccountSummary API Documentation.

 

How to call the PrecisionLender API V2 Powers

The V2 powers will be called via their respective PrecisionLender model properties via the PrecisionLender powers and then returned as a promise:

Opportunity

//getOpportunityResponse
skillContext.powers.precisionLender.opportunity
.api.v2.getOpportunityResponse(opportunityId)
.then((opp) => {
//work within the oppportunityResponse model
})
//getOpportunityRelationshipImpactResponse skillContext.powers.precisionLender.opportunity
.api.v2.getOpportunityRelationshipImpactResponse(opportunityId)
.then((opp) => {
//work within the oppportunityRelationshipImpactResponse model
})

 

Relationship

//getRelationshipSummaryResponse
skillContext.powers.precisionLender.relationship
.api.v2.getRelationshipSummaryResponse(relationshipId)
.then((relationship) => {
//work within the relationshipSummaryResponse model
})
//getRelationshipAccountSummariesResponse skillContext.powers.precisionLender.relationship
.api.v2.getRelationshipAccountSummariesResponse(relationshipId)
.then((relationship) => {
//work within the relationshipAccountSummariesResponse model
})

 

Here's an example of skill code that retrieves the stage of an opportunity using the V2 power:

return skillContext.powers.precisionLender
   .opportunity.getSavedOpportunityModel()
   .then((opportunityModel) => {
       if (!opportunityModel){return null;}
            return opportunityModel.id.id
   })
   .then ((opportunityId) => {
            if(!opportunityId){return null}

         return skillContext.powers.precisionLender.opportunity
         .api.v2.getOpportunityResponse(opportunityId)
    })
    .then ((opportunityResponse) => {
        if(!opportunityResponse) {return null}

        let opportunityStage = opportunityResponse.stage

        return skillContext.powers.andi.email.sendEmail(
            "stage-change-email-notification",
            andiSkills.EmailFrequencyTypes.Daily,
            [new andiSkills.EmailUserModel("Joe Manager", "joemanager@bank.com")],
            "branchupdate@bank.com",
            "Opportunity Saved",
            "An opportunity has been saved in the following stage: " + opportunityStage + "!",
            "",
            ""
        ),
    })
    
Was this article helpful?
0 out of 0 found this helpful