Skip to content

Alerts & Notifications

Set up custom alerts and get notified about important business events via email, SMS, or webhook.

GET /v1/alerts

Get triggered alerts.

Parameters

ParameterTypeRequiredDescription
severitystringNocritical, warning, info, all (default: all)
statusstringNounread, read, all (default: unread)
typestringNoAlert type filter
limitnumberNoNumber of alerts (default: 50)

Example Request

bash
curl -H "Authorization: Bearer looha_your_api_key" \
  "https://api.looha.app/v1/alerts?severity=critical&status=unread"

Response

json
{
  "success": true,
  "data": {
    "alerts": [
      {
        "id": "alert_123",
        "ruleId": "rule_456",
        "type": "profit_drop",
        "severity": "critical",
        "title": "Profit dropped 25%",
        "message": "Daily profit decreased from 2000 SAR to 1500 SAR compared to last week average",
        "data": {
          "current": 1500,
          "previous": 2000,
          "change": -25
        },
        "triggeredAt": "2024-01-26T08:00:00Z",
        "status": "unread"
      },
      {
        "id": "alert_124",
        "ruleId": "rule_789",
        "type": "low_roas",
        "severity": "warning",
        "title": "Low ROAS on Meta campaign",
        "message": "Campaign 'Winter Sale' has Profit ROAS of 0.8 (below threshold of 1.5)",
        "data": {
          "campaign": "Winter Sale",
          "profitRoas": 0.8,
          "threshold": 1.5
        },
        "triggeredAt": "2024-01-26T07:30:00Z",
        "status": "unread"
      }
    ],
    "meta": {
      "total": 8,
      "unread": 5
    }
  }
}

POST /v1/alerts/:id/mark-read

Mark an alert as read.

Example Request

bash
curl -X POST \
  -H "Authorization: Bearer looha_your_api_key" \
  "https://api.looha.app/v1/alerts/alert_123/mark-read"

GET /v1/alerts/rules

Get your alert rules.

Example Request

bash
curl -H "Authorization: Bearer looha_your_api_key" \
  "https://api.looha.app/v1/alerts/rules"

Response

json
{
  "success": true,
  "data": {
    "rules": [
      {
        "id": "rule_456",
        "name": "Daily Profit Drop Alert",
        "type": "profit_drop",
        "condition": {
          "metric": "daily_profit",
          "operator": "decreases_by",
          "value": 20,
          "period": "1d"
        },
        "severity": "critical",
        "enabled": true,
        "channels": ["email", "sms"],
        "createdAt": "2024-01-15T10:00:00Z"
      }
    ]
  }
}

POST /v1/alerts/rules

Create a new alert rule.

Request Body

json
{
  "name": "Low Stock Alert",
  "type": "low_stock",
  "condition": {
    "metric": "stock_quantity",
    "operator": "less_than",
    "value": 10
  },
  "severity": "warning",
  "channels": ["email"]
}

Example Request

bash
curl -X POST \
  -H "Authorization: Bearer looha_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Low Stock Alert",
    "type": "low_stock",
    "condition": {
      "metric": "stock_quantity",
      "operator": "less_than",
      "value": 10
    },
    "severity": "warning",
    "channels": ["email"]
  }' \
  "https://api.looha.app/v1/alerts/rules"

Alert Types

TypeDescriptionCommon Use Case
profit_dropProfit decreasedMonitor daily performance
low_roasROAS below thresholdPause unprofitable campaigns
high_ad_spendAd spend exceeded limitBudget control
low_stockInventory running lowReorder products
order_spikeUnusual order increaseDetect viral products

Next: Reports →

Profit analytics platform for Saudi e-commerce merchants