Performs actions based on the presence of an element or on conditions of the content of the element.

Options:

OptionRequiredDescriptionExample
conditiontrue(object) A brief description on condition is given in table below.{
"compareValue": "2021-05-01",
"querySelector": ".updated",
"compareOperation": "Date Earlier Than"
}
ifTruefalse(array) set of actions to be performed if the condition is true.[
{
"action": "message",
"options":
{
"message": "new post",
"messageName": "m1"
}
}
]
ifFalsefalse(array) set of actions to be performed if the condition is false.[
{
"action": "message",
"options":
{
"message": "old post",
"messageName": "m1"
}
}
]

Description on option condition

OptionRequiredDescriptionExample
querySelectortrueelement to check if it exists in the page.updated
compareValuefalseThe value to compare with
(required if condition is related to comparing)
2021-05-01
compareOperationfalseType of condition. Possible Values : Element Exists |
Number Greater Than |
Number Less Than |
Text Matches |
Text Ends With |
Text Includes |
Text Starts With |
Link Includes |
Link Starts With |
Link Ends With |
Link Matches |
Date Earlier Than |
Date Later Than
Date Earlier Than

Example 1: Appends message based on the date present in the given element

{
        "action": "condition",
        "options": {
            "ifTrue": [
                {
                    "action": "message",
                    "options": {
                        "message": "new post",
                        "messageName": "m1"
                    }
                }
            ],
            "ifFalse": [
                {
                    "action": "message",
                    "options": {
                        "message": "old post",
                        "messageName": "m1"
                    }
                }
            ],
            "condition": {
                "compareValue": "2021-05-01",
                "querySelector": ".updated",
                "compareOperation": "Date Earlier Than"
            }
        }
    },