Fetch and update an alert
Move an alert to a different queue and attach an analyst comment. The comment is what makes the move traceable later; the SDK handles the field typing for you.
import sasvi
client = sasvi.SVIClient.from_env()
alert = client.alerts.get(alert_id="<alert-id>")
if alert is None:
raise SystemExit("alert not found")
alert.update_fields(queue_id="<queue-id>", alert_status_id="<status-id>")
alert.comments.create(
text="Routed to fraud queue after enrichment matched the watchlist.",
category="TRIAGE",
)
print(repr(alert))
# Alert(id='...', status='...', score=78, queue='...')
The two calls are independent. The SDK does not batch a field update together with a comment, so a failure between them leaves the queue changed and the comment missing. Both calls are quick, and the comment carries the reason for the queue change.
Async
import asyncio
import sasvi
async def route(alert_id: str, queue_id: str, comment: str) -> None:
async with sasvi.SVIClient.from_env() as client:
alert = await client.alerts.get_async(alert_id=alert_id)
if alert is None:
return
await alert.update_fields_async(queue_id=queue_id)
await alert.comments.create_async(text=comment, category="TRIAGE")
asyncio.run(route("<alert-id>", "<queue-id>", "Routed."))
Go further
- Alerts guide. Disposition, scenario fired events, and contributing objects.
- Documents guide. The same
update_fieldssemantics apply to plain documents.