Files
motia-iii/steps/notify_customer_step.py
bsiggel b3bdb56753 Initial commit: Motia III Backend Setup
- iii-config.yaml mit Production-Settings (CORS, all interfaces)
- Ticketing-System Steps (create, triage, escalate, notify, SLA monitoring)
- Python dependencies via uv
- Systemd services für Motia Engine und iii Console
- README mit Deployment-Info
2026-03-01 21:38:07 +00:00

38 lines
1.1 KiB
Python

"""Notify Customer Step - sends a notification when a ticket has been triaged."""
import re
from typing import Any
from motia import FlowContext, queue
config = {
"name": "NotifyCustomer",
"description": "Sends a notification when a ticket has been triaged",
"flows": ["support-ticket-flow"],
"triggers": [
queue("ticket::triaged"),
],
"enqueues": [],
}
async def handler(input_data: Any, ctx: FlowContext[Any]) -> None:
ticket_id = input_data.get("ticketId")
assignee = input_data.get("assignee")
priority = input_data.get("priority")
title = input_data.get("title")
ctx.logger.info("Sending customer notification", {"ticketId": ticket_id, "assignee": assignee})
ticket = await ctx.state.get("tickets", ticket_id)
customer_email = ticket.get("customerEmail", "") if ticket else ""
redacted_email = re.sub(r"(?<=.{2}).(?=.*@)", "*", customer_email) if customer_email else "unknown"
ctx.logger.info("Notification sent", {
"ticketId": ticket_id,
"assignee": assignee,
"priority": priority,
"title": title,
"email": redacted_email,
})