Options
All
  • Public
  • Public/Protected
  • All
Menu

Powers are a set of utility functions available to skill writers that enables them to easily perform common actions such as http get request or send an email. Each power functions are documented below that explains its purpose along with the parameters & return types. Within the skill's ShouldIRun or Run method, 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.", "", "" );

Hierarchy

  • IPowerSet

Index

Properties

andi

andi: object

andi powers

Type declaration

  • email: object

    Use this power to send skill run result through email channel. Email channel supports html body format.

    • composeEmail: function
      • composeEmail(emailCategory: string, frequencyType: EmailFrequencyTypes, toAddress: EmailUserModel[], fromAddress: string, subject: string, body: string, footer: string, bodyHeader: string): any
      • composeEmail can be used to generate an email message - very similar to sendEmail but does not send actual email - still work in progress

        Parameters

        • emailCategory: string

          Use this parameter to give a category name for your message - multiple messages with the same email frequencyType, email category, email subject and same to address are grouped together and sent as one email to reduce email noise. Leave it blank for a simple email message.

        • frequencyType: EmailFrequencyTypes

          Refer to EmailFrequencyTypes documentation (usage andiSkills.EmailFrequencyTypes.OneMinute)- Currently supported email frequency types are: OneMinute (use this frequency if you want send email in the next one minute), FiveMinute, Hourly, Daily (use this frequency if you want to send email daily at 8 am EST), Weekly, BeginingOfMonth and EndOfMonth.

        • toAddress: EmailUserModel[]

          Refer to EmailUserModel documentation - array of email users - e.g. [new andiSkills.EmailUserModel("your name", "yourname@youremailaddress.com")].

        • fromAddress: string

          From address that will be attached to the email.

        • subject: string

          Subject for the email message - all emails with the same subject, same email frequency and same email to address will be combined together as one email to reduce email noise.

        • body: string

          Body of the email - this can be plain text or html.

        • footer: string

          Any special footer message - e.g. link to a disclaimer notice.

        • bodyHeader: string

          Any special header text - this is displayed at the begining of the email body in bold format.

        Returns any

        Returns a promise, once it is completed it should place message in the email queue.

    • sendEmail: function
      • Use this ´sendEmail´ method to send email notifications.

        Parameters

        • emailCategory: string

          Use this parameter to give a category name for your message - multiple messages with the same email frequencyType, email category, email subject and same to address are grouped together and sent as one email to reduce email noise. Leave it blank for a simple email message.

        • frequencyType: EmailFrequencyTypes

          Refer to EmailFrequencyTypes documentation (usage andiSkills.EmailFrequencyTypes.OneMinute)- Currently supported email frequency types are: OneMinute (use this frequency if you want send email in the next one minute), FiveMinute, Hourly, Daily (use this frequency if you want to send email daily at 8 am EST), Weekly, BeginingOfMonth and EndOfMonth.

        • toAddress: EmailUserModel[]

          Refer to EmailUserModel documentation - array of email users - e.g. [new andiSkills.EmailUserModel("your name", "yourname@youremailaddress.com")].

        • fromAddress: string

          From address that will be attached to the email.

        • subject: string

          Subject for the email message - all emails with the same subject, same email frequency and same email to address will be combined together as one email to reduce email noise.

        • body: string

          Body of the email - this can be plain text or html.

        • footer: string

          Any special footer message - e.g. link to a disclaimer notice.

        • bodyHeader: string

          Any special header text - this is displayed at the begining of the email body in bold format.

        Returns Promise<ISkillActivity>

        Returns a promise, once it is completed it should place message in the email queue.

  • event: object

    Use this power to get specific type of event i.e. Application vs Natural Language events

    • checkDailyMidnightEvent: function
      • Use this ´checkDailyMidnightEvent´ method to check if it is midnight - use this event for running special skills at this time.

        Parameters

        • skillContext: ISkillContext

          current skill context - i.e. the passed in parameter to shouldIRun or run method.

        Returns boolean

        Returns true or false.

    • checkFiveMinuteIntervalEvent: function
      • checkFiveMinuteIntervalEvent(skillContext: ISkillContext): boolean
      • Use this ´checkFiveMinuteIntervalEvent´ method to check if five minutes has elapsed.

        Parameters

        • skillContext: ISkillContext

          current skill context - i.e. the passed in parameter to shouldIRun or run method.

        Returns boolean

        Returns true or false.

    • checkHourlyIntervalEvent: function
      • Use this ´checkHourlyIntervalEvent´ method to check if an hour has elapsed.

        Parameters

        • skillContext: ISkillContext

          current skill context - i.e. the passed in parameter to shouldIRun or run method.

        Returns boolean

        Returns true or false.

    • checkOneMinuteIntervalEvent: function
      • checkOneMinuteIntervalEvent(skillContext: ISkillContext): boolean
      • Use this ´checkOneMinuteIntervalEvent´ method to check if one minute has elapsed.

        Parameters

        • skillContext: ISkillContext

          current skill context - i.e. the passed in parameter to shouldIRun or run method.

        Returns boolean

        Returns true or false.

    • checkWeeklySundayMidnightEvent: function
      • checkWeeklySundayMidnightEvent(skillContext: ISkillContext): boolean
      • Use this ´checkWeeklySundayMidnightEvent´ method to check if it is sunday midnight - use this event for running special skills at this time.

        Parameters

        • skillContext: ISkillContext

          current skill context - i.e. the passed in parameter to shouldIRun or run method.

        Returns boolean

        Returns true or false.

    • getApplicationEvent: function
      • Use this ´getApplicationEvent´ method to get an event in IApplicationEvent format - refer to IApplicationEvent documentation.

        Parameters

        • skillContext: ISkillContext

          current skill context - i.e. the passed in parameter to shouldIRun or run method.

        Returns IApplicationEvent

        Returns IApplicationEvent if the event is an application event otherwise null.

    • getNaturalLanguageEvent: function
      • Use this ´getNaturalLanguageEvent´ method to get an event in INaturalLanguageEvent format - refer to INaturalLanguageEvent documentation.

        Parameters

        • skillContext: ISkillContext

          current skill context - i.e. the passed in parameter to shouldIRun or run method.

        Returns INaturalLanguageEvent

        Returns INaturalLanguageEvent if the event is a natural language event otherwise null.

  • fieldTag: object

    Use this power to send field tag message that gets displayed in the browser through client side Andi. Currently, only works on PrecisionLender Opportunity Page UI.

    • composeFieldTag: function
      • composeFieldTag(fieldTagType: FieldTagTypes, key: string, displayOrder: number, text: string, fields: string[], section: any, shouldIShow: function, action?: function, compareHash?: number | string, custom?: any, customIcon?: string): any
      • composeFieldTag can be used to generate field tag message - very similar to sendFieldTag but does not send actual field tag - still work in progress

        Parameters

        • fieldTagType: FieldTagTypes

          Refer to FieldTagTypes documentation (usage andiSkills.FieldTagTypes.Info) - different tag types options are Info, Warning, ValueForTarget and Help.

        • key: string

          Unique key to represent field tag on browser - always ensure that this key is updated to a unique value before deploying any skill.

        • displayOrder: number

          Display order number - client side Andi can use this for sorting the order of the field tag messages.

        • text: string

          Text to show - field tag message that gets displayed to the user.

        • fields: string[]

          Name of fields in an array where this message gets displayed on the UI. Consult your UI developer for finding out field names available on a page.

        • section: any

          Name of the special section to show this message under - work in progress.

        • shouldIShow: function

          Client side function that can be written within the skill to evaluate any special condition using the client side data to determine if field tag should be displayed - data passed are client side api, client side model, comparehash (a special selected field hash) and custom bag that can be sent from server as a custom parameter (i.e. the second last parameter of this method) .

            • (api: any, model: any, compareHash?: number | string, custom?: any): boolean
            • Parameters

              • api: any
              • model: any
              • Optional compareHash: number | string
              • Optional custom: any

              Returns boolean

        • Optional action: function

          Similar to shouldIShow parameter except when action is set, the field tag message is shown as an actionable link and on click of that link the code inside this action function is invoked.

            • (api: any, model: any, custom?: any): void
            • Parameters

              • api: any
              • model: any
              • Optional custom: any

              Returns void

        • Optional compareHash: number | string

          Compare hash that can be sent from server and used by client side shouldIShow or action function.

        • Optional custom: any

          Custom object that can be sent from server and used by client side shouldIShow or action function.

        • Optional customIcon: string

          Custom icon url that can be sent from server and used by client side Andi to prefix icon before the text message.

        Returns any

        Returns a promise, once it is completed it should send the field tag message to client side Andi.

    • sendFieldTag: function
      • sendFieldTag(fieldTagType: FieldTagTypes, key: string, displayOrder: number, text: string, fields: string[], section: any, shouldIShow: function, action?: function, compareHash?: number | string, custom?: any, customIcon?: string): Promise<ISkillActivity>
      • Use this ´sendFieldTag´ method to send field tag message to the client side Andi.

        Parameters

        • fieldTagType: FieldTagTypes

          Refer to FieldTagTypes documentation (usage andiSkills.FieldTagTypes.Info) - different tag types options are Info, Warning, ValueForTarget and Help.

        • key: string

          Unique key to represent field tag on browser - always ensure that this key is updated to a unique value before deploying any skill.

        • displayOrder: number

          Display order number - client side Andi can use this for sorting the order of the field tag messages.

        • text: string

          Text to show - field tag message that gets displayed to the user.

        • fields: string[]

          Name of fields in an array where this message gets displayed on the UI. Consult your UI developer for finding out field names available on a page.

        • section: any

          Name of the special section to show this message under - work in progress.

        • shouldIShow: function

          Client side function that can be written within the skill to evaluate any special condition using the client side data to determine if field tag should be displayed - data passed are client side api, client side model, comparehash (a special selected field hash) and custom bag that can be sent from server as a custom parameter (i.e. the second last parameter of this method) .

            • (api: any, model: any, compareHash?: number | string, custom?: any): boolean
            • Parameters

              • api: any
              • model: any
              • Optional compareHash: number | string
              • Optional custom: any

              Returns boolean

        • Optional action: function

          Similar to shouldIShow parameter except when action is set, the field tag message is shown as an actionable link and on click of that link the code inside this action function is invoked.

            • (api: any, model: any, custom?: any): void
            • Parameters

              • api: any
              • model: any
              • Optional custom: any

              Returns void

        • Optional compareHash: number | string

          Compare hash that can be sent from server and used by client side shouldIShow or action function.

        • Optional custom: any

          Custom object that can be sent from server and used by client side shouldIShow or action function.

        • Optional customIcon: string

          Custom icon url that can be sent from server and used by client side Andi to prefix icon before the text message.

        Returns Promise<ISkillActivity>

        Returns a promise, once it is completed it should send the field tag message to client side Andi.

  • initialize: object

    Use this power to easily return success or failure from initialize method

    • initializeFailure: function
      • Use this ´initializeFailure´ method incase of a failure on initialization - it encapsulates the promise return types.

        Returns Promise<ISkillInitializationResult>

        Returns a promise, once it is completed it should send the initialization failure message.

    • initializeSuccess: function
      • Use this ´initializeSuccess´ method to return success on initialization- it encapsulates the promise return types - e.g. .

        Returns Promise<ISkillInitializationResult>

        Returns a promise, once it is completed it should send the initialization success message.

  • instantAction: object

    Use this power to invoke an instant action on the browser through client side Andi. Currently, only works on PrecisionLender Opportunity Page UI.

    • composeInstantAction: function
      • composeInstantAction(name: string, shouldIRun: function, action: function, compareHash?: number | string, custom?: any): any
      • composeInstantAction can be used to generate instant action message - very similar to sendInstantAction but does not send actual instant action message - still work in progress

        Parameters

        • name: string

          name of the instant action - ensure this to be unique before deploying any skill.

        • shouldIRun: function
            • (api: any, model: any, compareHash?: number | string, custom?: any): boolean
            • Parameters

              • api: any
              • model: any
              • Optional compareHash: number | string
              • Optional custom: any

              Returns boolean

        • action: function

          similar to shouldIShow parameter except when action is set, the field tag message is shown as an actionable link and on click of that link the code inside this action function is invoked.

            • (api: any, model: any, custom?: any): void
            • Parameters

              • api: any
              • model: any
              • Optional custom: any

              Returns void

        • Optional compareHash: number | string

          compare hash that can be sent from server and used by client side shouldIShow or action function.

        • Optional custom: any

          custom object that can be sent from server and used by client side shouldIShow or action function.

        Returns any

        Returns a promise, once it is completed it should send the instant action message to client side Andi.

    • sendInstantAction: function
      • sendInstantAction(name: string, shouldIRun: function, action: function, compareHash?: number | string, custom?: any): Promise<ISkillActivity>
      • Use this ´sendFieldTag´ method to send field tag message to the client side Andi.

        Parameters

        • name: string

          name of the instant action - ensure this to be unique before deploying any skill.

        • shouldIRun: function
            • (api: any, model: any, compareHash?: number | string, custom?: any): boolean
            • Parameters

              • api: any
              • model: any
              • Optional compareHash: number | string
              • Optional custom: any

              Returns boolean

        • action: function

          similar to shouldIShow parameter except when action is set, the field tag message is shown as an actionable link and on click of that link the code inside this action function is invoked.

            • (api: any, model: any, custom?: any): void
            • Parameters

              • api: any
              • model: any
              • Optional custom: any

              Returns void

        • Optional compareHash: number | string

          compare hash that can be sent from server and used by client side shouldIShow or action function.

        • Optional custom: any

          custom object that can be sent from server and used by client side shouldIShow or action function.

        Returns Promise<ISkillActivity>

        Returns a promise, once it is completed it should send the instant action message to client side Andi.

  • naturalLanguageProcessing: object

    Use this power to create custom natural language processing (NLP) responses

  • request: object

    Use this power to make external https get or post request.

    • get: function
      • get(url: string, headers: any): Promise<any>
      • Use this ´get´ method to make an https get call.

        Parameters

        • url: string

          Url value that get request will call.

        • headers: any

          Header values for get request.

        Returns Promise<any>

        Returns a promise when completed should return the object received from https get request.

    • post: function
      • post(url: string, headers: any, data: any): Promise<any>
      • Use this ´post´ method to make an https post call.

        Parameters

        • url: string

          Url that post request will call.

        • headers: any

          Header values for post request.

        • data: any

          Json post body for post request.

        Returns Promise<any>

        Returns a promise, once it is completed it should return the object received from https post request.

  • secretKeys: object

    Use this power to get secret keys that are encrypted and stored at organization/application/skill level from Andi Gallery.

    • getOrganizationAppLevelKey: function
      • getOrganizationAppLevelKey(skillContext: ISkillContext, keyName: string): Promise<any>
      • Use this ´getOrganizationAppLevelKey´ method to retrieve any encrypted key configured and stored from Andi Gallery at the organzation/application level.

        Parameters

        • skillContext: ISkillContext

          current skill context - i.e. the passed in parameter to shouldIRun or run method.

        • keyName: string

          name of the key to retrieve.

        Returns Promise<any>

        Returns the key value object if present otherwise null.

  • shouldIRun: object

    Use this power to easily return true or false from shouldIRun method

    • shouldIRunFalse: function
      • Use this ´shouldIRunTrue´ method to return false from shouldIRunTrue- it encapsulates the promise return types.

        Returns Promise<IShouldIRunResponse>

        Returns a promise, once it is completed it should return false which will prevent skill run function from executing.

    • shouldIRunTrue: function
      • Use this ´shouldIRunTrue´ method to return true from shouldIRunTrue- it encapsulates the promise return types.

        Returns Promise<IShouldIRunResponse>

        Returns a promise, once it is completed it should return true which will cause skill run function to be called.

core

core: object

Type declaration

precisionLender

precisionLender: object

precisionLender powers

Type declaration

  • api: object

    Use this power to query precisionLender api endpoints. This power will use precisionLender service username and password secret keys which can be configure and stored as a secret from Andi Gallery.

    • get: function
      • Use this ´get´ method to get data from api endpoints.

        Parameters

        • skillContext: ISkillContext

          current skill context - i.e. the passed in parameter to shouldIRun or run method.

        • url: string

          api endpoint url to query.

        Returns Promise<any>

        Returns response result from api endpoint when successfull otherwise returns null.

  • opportunity: object

    Use this power to examine an application event for opportunity specific data.

    • getDepositAccounts: function
      • Use this ´getDepositAccounts´ method to get deposit accounts from the event data.

        Parameters

        • skillContext: ISkillContext

          current skill context - i.e. the passed in parameter to shouldIRun or run method.

        Returns any[]

        Returns deposit accounts as an array if it is an opportunity change event otherwise returns null.

    • getLoanAccounts: function
      • Use this ´getLoanAccounts´ method to get loan accounts from the event data.

        Parameters

        • skillContext: ISkillContext

          current skill context - i.e. the passed in parameter to shouldIRun or run method.

        Returns any[]

        Returns loan accounts as an array if it is an opportunity change event otherwise returns null.

    • getOpportunityChangeEventData: function
      • getOpportunityChangeEventData(skillContext: ISkillContext): any
      • Use this ´getOpportunityChangeEventData´ method to get opportunity change data from the event.

        Parameters

        • skillContext: ISkillContext

          current skill context - i.e. the passed in parameter to shouldIRun or run method.

        Returns any

        Returns event data as an object if it is an opportunity change event otherwise returns null.

    • getOtherFeesAccounts: function
      • Use this ´getOtherFeesAccounts´ method to get other/fees accounts from the event data.

        Parameters

        • skillContext: ISkillContext

          current skill context - i.e. the passed in parameter to shouldIRun or run method.

        Returns any[]

        Returns other/fees accounts as an array if it is an opportunity change event otherwise returns null.

    • isDepositAccountChangeEvent: function
      • isDepositAccountChangeEvent(skillContext: ISkillContext): boolean
      • Use this ´isDepositAccountChangeEvent´ method to check if an incoming event is a deposit account change event.

        Parameters

        • skillContext: ISkillContext

          current skill context - i.e. the passed in parameter to shouldIRun or run method.

        Returns boolean

        Returns true or false.

    • isLoanAccountChangeEvent: function
      • Use this ´isLoanAccountChangeEvent´ method to check if an incoming event is a loan change event.

        Parameters

        • skillContext: ISkillContext

          current skill context - i.e. the passed in parameter to shouldIRun or run method.

        Returns boolean

        Returns true or false.

    • isOpportunityChangeEvent: function
      • Use this ´isOpportunityChangeEvent´ method to check if an incoming event is an opportunity change event.

        Parameters

        • skillContext: ISkillContext

          current skill context - i.e. the passed in parameter to shouldIRun or run method.

        Returns boolean

        Returns true or false.

    • isOtherAccountChangeEvent: function
      • isOtherAccountChangeEvent(skillContext: ISkillContext): boolean
      • Use this ´isOtherAccountChangeEvent´ method to check if an incoming event is an other account change event.

        Parameters

        • skillContext: ISkillContext

          current skill context - i.e. the passed in parameter to shouldIRun or run method.

        Returns boolean

        Returns true or false.

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc