Moogsoft Docs

Moolet Information API

You can use the following commands in a Moobot file to obtain contextual information about the associated Moolet. These commands are useful in automation and other workflows where you want to verify the Moolet context before performing an action such as sending data.

Bot.getType

Return the Moolet type. If the result is Bot.WORKFLOW_ENGINE, you can call Bot.WorkflowEngine.getMessageType()  to find the workflow-engine type.

Request Arguments

None.

Return Parameter

Type

Description

Enumerated type

Can be one of the following:

  • Bot.ALERT_BUILDER

  • Bot.ALERT_RULE_ENGINE

  • Bot.COOKBOOK

  • Bot.EMPTY_MOOLET

  • Bot.NOTIFIER

  • Bot.SCHEDULER

  • Bot.SITUATION_MANAGER

  • Bot.TEAMS_MANAGER

  • Bot.WORKFLOW_ENGINE

Example

var MooletType = Bot.getType();
logger.warning(' Moolet type is ...' +MooletType);
Bot.getMooletName

Return the Moolet type

Request Arguments

None.

Return Parameter

Type

Description

String

Name of the associated Moolet.

Example

if((Bot.getType() === Bot.EMPTY_MOOLET ))
   {logger.warning(Bot.getMooletName() + ' is an empty moolet')};
Bot.WorkflowEngine.getMessageType

Return the workflow engine type, or null for non-workflow-engine Moolets.

Request Arguments

None.

Return Parameters

Type

Description

String

Can be one of the following:

  • Bot.WorkflowEngine.ALERT

  • Bot.WorkflowEngine.SITUATION

  • Bot.WorkflowEngine.EVENT

  • null (if the associated Moolet is not a workflow engine)

Example

if((Bot.getType() === Bot.WORKFLOW_ENGINE) && (Bot.workflowEngine.getMessageType() === Bot.workflowEngine.ALERT)) 
   {logger.warning('Moolet ' + Bot.getMooletName() + ' will handle alerts')}