Andi Skill Builder API Documentation

Andi Skill Builder API Documentation

Quick Links

Overview

The following documentation is designed to help provide more detail for Andi Skill Writing. The same documentation is displayed inline within the Andi Skills Builder as well but this intended as static reference where you call lookup things without the need of having to be directly in the Builder which can be useful for researching certain capabilities.

In order to get the most from this documentation it is recommended that you also use the Andi Support site.

For quick access older Powers Documentation can be found here. All older powers are accessed from the skillContext defined in the method signatures of shouldIRun and run.

Newer powers are imported by the skill writer. For example the writer wanted to use TagPowers and HttpPowers they would use and import at the top of the run or shouldIRun section.


import { FieldTag, TagPowers } from "@andi/powers";
import { FieldTagTypes, ISkillContext, ISkillActivity } from "andiskills";
import { CommercialLoanAccount } from "andiskills/lib/external/precisionLender/opportunity/OpportunityModels";
import { HttpPowers } from "@andi/powers/HttpPowers";
import { SkillHttpResponse } from "@andi/powers/models/SkillHttpService";

// this is main execution of the skill which is called after the andi
// skills platforms determines if it should run
export async function run(skillContext: ISkillContext) : Promise<ISkillActivity> {
    const apiResponse: SkillHttpResponse<string> = await HttpPowers.get<string>("http://example.com/somedata");
    const fieldTypeText = apiResponse.data;

    const event = skillContext.powers.andi.event.getApplicationEvent(skillContext);
    const data = event.applicationEventData;

    const cla: CommercialLoanAccount = data.engineModel.commercialLoanAccounts.find((cla) => {
        return cla.id === data.contextId;
    });

    const fieldTag: FieldTag = {
        fields: ["amount"],
        text: fieldTypeText,
        tagType: FieldTagTypes.Info,
        key: "uniqueTemplateKey",
        //Andi should only load this field tag if the amount hasn't changed 
        loadWhen: [{
            query: { name: "getRawAmount", args: [] },
            comparator: "==",
            value: cla.amount,
            type: "number"
        }]
    };

    return TagPowers.sendTags([fieldTag]);
}

Generated using TypeDoc