Skip to main content

scheduling Scenario 1 — Hourly Price Check with Alert Threshold

Written by RTILA X Engineering Team

Beginner ~4 min

What You'll Learn

Add fixed delays between commands

Real-World Use Case

Throttling requests to avoid rate limits

LIVE DEMO

Price Monitor

Read the current and previous prices and compute the drop percentage.

Price Monitor — Product 101

$249.99
DatePrice
2025-04-01 $259.99
2025-04-08 $279.99
2025-04-15 $299.99
2025-04-22 $249.99
2025-04-29 $249.99

Price dropped by 16.7% from last check

EXPECTED OUTPUT

Price Check Result

{
  "product_id": 101,
  "current_price": 249.99,
  "previous_price": 299.99,
  "price_drop_percent": 16.7,
  "alert_triggered": true
}
RTILA X PROJECT JSON

RTILA X Automation Project

hourly-price-check.json
{
  "name": "Hourly_Price_Check",
  "settings": {
    "urls": [
      "https://learn.rtila.com/scenarios/scheduling/1"
    ]
  },
  "commands": [
    {
      "command": "get_text",
      "params": {
        "selector": "css=.price-value",
        "output_variable": "current_price"
      }
    },
    {
      "command": "get_text",
      "params": {
        "selector": "css=.price-history-table tbody tr:nth-child(3) td:nth-child(2)",
        "output_variable": "previous_price"
      }
    },
    {
      "command": "run_script",
      "params": {
        "script": "export default async function(page, context, state, helpers) { const clean = (value) => parseFloat(String(value).replace(/[^0-9.-]/g, '')); const previous = clean(state.variables.previous_price); const current = clean(state.variables.current_price); const drop = ((previous - current) / previous) * 100; state.variables.price_drop_percent = drop; return drop; }"
      }
    },
    {
      "command": "if",
      "params": {
        "condition": {
          "type": "script",
          "expression": "${price_drop_percent} > 10"
        },
        "then": [
          {
            "command": "comment",
            "params": {
              "text": "Send alert: price dropped by ${price_drop_percent}%"
            }
          }
        ],
        "else": [
          {
            "command": "comment",
            "params": {
              "text": "No alert needed"
            }
          }
        ]
      }
    }
  ]
}

Scheduled automations run periodically without user interaction. This example reads the current and previous prices, calculates the drop percentage, and triggers an alert if the drop exceeds 10%.

Did you complete this scenario?

Ready to run this automation?

Copy the project JSON above, open RTILA X, create a new project, and paste it.

This scenario covers 1 RTILA X command and is referenced in 2 learning articles.

Continue Learning

Was this helpful?