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
| Parameter | Type | Required | Description |
|---|---|---|---|
severity | string | No | critical, warning, info, all (default: all) |
status | string | No | unread, read, all (default: unread) |
type | string | No | Alert type filter |
limit | number | No | Number 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
| Type | Description | Common Use Case |
|---|---|---|
profit_drop | Profit decreased | Monitor daily performance |
low_roas | ROAS below threshold | Pause unprofitable campaigns |
high_ad_spend | Ad spend exceeded limit | Budget control |
low_stock | Inventory running low | Reorder products |
order_spike | Unusual order increase | Detect viral products |
Next: Reports →