Andi Skill Builder API Documentation

Interface: IPowerSet

Powers are a set of utility functions available to skill writers that enables them to easily perform common actions such as an HTTP GET request or send an email. Within the skill's ShouldIRun or Run methods, powers are available through the passed in skillContext: andiSkills.ISkillContext parameter. You can access the powers available to any skill through the skillContext.powers property. For example, skill writers can use the email power to deliver their insight through email.

Here is a code snippet for sending email from inside the skill Run method that uses the EmailFrequencyType of OneMinute which means this email message will be sent within the next minute whenever this skill code executes:

skillContext.powers.andi.email.sendEmail(
    "opportunity-changed-email",
    andiSkills.EmailFrequencyTypes.OneMinute,
    [new andiSkills.EmailUserModel("yourname", "yourname@youremail.com")],
    "reply@youremail.com",
    "Test Email",
    "This is a test email.",
    "",
    ""
);

Properties

Property Description
andi Main powers namespace — email, tags, events, storage, chat, and more
core Core utilities — logging
machineLearning Machine learning — NLU predictions
precisionLender PrecisionLender API access — opportunities, relationships, engine

core

core.log.debug()

core.log.debug(message: string): void

Use the debug power to log small messages to your debug tab in the Andi Skills Manager. NOTE: The debug power only works when a skill version is in a development workgroup. If in a production workgroup, debug messages will not be saved.

Parameters

Parameter Type Description
message string Short debug message to help troubleshoot your skill

Throws Error when all debug messages combined are 1024 characters or larger.


andi

The main powers namespace providing access to email, field tags, events, storage, chat, batch jobs, and more.

andi.request

Method Signature Description
get get<T>(url: string): Promise<T> Perform an HTTP GET request
post post<T>(url: string, data: any): Promise<T> Perform an HTTP POST request

andi.email

Method Signature Description
sendEmail sendEmail(subject: string, frequency: EmailFrequencyTypes, to: EmailUserModel[], replyTo: string, emailSubject: string, body: string, cc?: string, bcc?: string): void Send an email with the specified frequency
composeEmail composeEmail(subject: string, frequency: EmailFrequencyTypes, to: EmailUserModel[], replyTo: string, emailSubject: string, body: string, cc?: string, bcc?: string): Promise<ISkillActivity> Compose and return email as a skill activity

andi.fieldTag

Method Signature Description
composeFieldTag composeFieldTag(fields: string[], text: string, tagType: FieldTagTypes, key: string): ITag Compose a field tag
sendFieldTag sendFieldTag(fields: string[], text: string, tagType: FieldTagTypes, key: string): Promise<ISkillActivity> Send a field tag
sendFieldTags sendFieldTags(tags: ITag[]): Promise<ISkillActivity> Send multiple field tags

andi.event

Method Signature Description
getApplicationEvent getApplicationEvent(skillContext: ISkillContext): IApplicationEvent Get the application event that triggered this skill
getNaturalLanguageEvent getNaturalLanguageEvent(skillContext: ISkillContext): INaturalLanguageEvent Get the natural language event
checkDailyMidnightEvent checkDailyMidnightEvent: boolean Check if this is a daily midnight event
checkFiveMinuteIntervalEvent checkFiveMinuteIntervalEvent: boolean Check if this is a 5-minute interval event
checkHourlyIntervalEvent checkHourlyIntervalEvent: boolean Check if this is an hourly interval event
checkOneMinuteIntervalEvent checkOneMinuteIntervalEvent: boolean Check if this is a 1-minute interval event
checkWeeklySundayMidnightEvent checkWeeklySundayMidnightEvent: boolean Check if this is a weekly Sunday midnight event

andi.batchJob

Method Signature Description
fireAtMidnight fireAtMidnight(skillContext?: ISkillContext): Promise<IShouldIRunResponse> Schedule skill to run at midnight
fireAtSundayMidnight fireAtSundayMidnight(skillContext?: ISkillContext): Promise<IShouldIRunResponse> Schedule skill to run at Sunday midnight
returnRunComplete returnRunComplete(skillContext?: ISkillContext): Promise<ISkillActivity> Return a successful run completion

andi.chat

Method Signature Description
addArticle addArticle: void Add an article to chat
addSimpleHeader addSimpleHeader: void Add a simple header to chat
composeResponse composeResponse: Promise<AndiBotResponseModel> Compose a chat response
getTopScoringIntent getTopScoringIntent: INaturalLanguageUnderstandingResult Get the top scoring NLU intent
sendResponse sendResponse: Promise<ISkillActivity> Send a chat response
sendSimpleHeader sendSimpleHeader: Promise<ISkillActivity> Send a simple header

andi.secretKeys

Method Signature Description
getOrganizationAppLevelKey getOrganizationAppLevelKey: Promise<any> Get an organization-level secret key

andi.storage

Method Signature Description
get2dCSVFile get2dCSVFile: any Get a 2D CSV file
getCSVFile getCSVFile: any Get a CSV file
getFile getFile: any Get a file from storage
getJSONFile getJSONFile: any Get a JSON file
getJSONFileOf getJSONFileOf: any Get a typed JSON file
putFile putFile: any Put a file to storage

andi.shouldIRun

Method Signature Description
shouldRunFalse shouldRunFalse: Promise<IShouldIRunResponse> Return false for shouldIRun
shouldRunTrue shouldRunTrue: Promise<IShouldIRunResponse> Return true for shouldIRun

andi.initialize

Method Signature Description
initializeFailure initializeFailure: Promise<ISkillInitializationResult> Return initialization failure
initializeSuccess initializeSuccess: Promise<ISkillInitializationResult> Return initialization success

andi.dialogue

Method Signature Description
composeDialogueTag composeDialogueTag: ITag Compose a dialogue tag
sendDialogueResponseWithTags sendDialogueResponseWithTags: Promise<ISkillActivity> Send a dialogue response with tags

andi.dataSets

Method Signature Description
getDataSet getDataSet: IDataSetClient Get a data set client

andi.fileAttachments

Method Signature Description
conversation.storeCsvFileForCurrentUser storeCsvFileForCurrentUser: Promise<StoreAttachmentResponse> Store a CSV file attachment for the current user

precisionLender

Access to PrecisionLender application data — opportunities, relationships, engine calculations, and solver.

precisionLender.opportunity

Access opportunity data from the current PrecisionLender context.

precisionLender.relationship

Access relationship data from the current PrecisionLender context.

precisionLender.engine

Access engine calculation results.

precisionLender.engine.solver

Method Signature Description
getSolverResults Returns solver calculation results Get solver results for the current deal

machineLearning

machineLearning.getNaturalLanguageUnderstandingResult

getNaturalLanguageUnderstandingResult(skillContext: ISkillContext): INaturalLanguageUnderstandingResult

Get the natural language understanding prediction result for the current context.

Parameters

Parameter Type Description
skillContext ISkillContext The current skill context

Returns INaturalLanguageUnderstandingResult