You can use the Moolet Information API or Bot API methods in a Moobot to obtain contextual information about the associated Moolet. These methods are useful in automation and other workflows where you want to verify the Moolet context before performing an action such as sending data.
The Moolet Information API uses the following methods.
Retrieves the Moolet type.
The method takes no arguments.
The method returns one of the following parameters.
Type | Description |
---|---|
Enumerated type | One of the following:
|
If the result is WORKFLOW_ENGINE you can use the WorkflowEngine.getMessageType
method to retrieve the Workflow Engine type.
Example use of the getType
method:
var MooletType = Bot.getType();
logger.warning(' Moolet type is ...' +MooletType);
Retrieves the Moolet name.
The method takes no arguments.
The method returns the following parameter.
Type | Description |
---|---|
String | Name of the associated Moolet. |
Example use of the getMooletName method:
if((Bot.getType() === Bot.EMPTY_MOOLET ))
{
logger.warning(Bot.getMooletName() + ' is an empty moolet')
};
Retrieves the Workflow Engine type. Returns null for non-Workflow Engine Moolets.
The method takes no arguments.
The method returns one of the following parameters.
Type | Description |
---|---|
String | One of the following:
|
Example use of the WorkflowEngine.getMessageType method:
if((Bot.getType() === Bot.WORKFLOW_ENGINE)
&& (Bot.workflowEngine.getMessageType() === Bot.workflowEngine.ALERT))
{
logger.warning('Moolet ' + Bot.getMooletName() + ' will handle alerts')
}