Quick overview
This workflow ingests Zendesk escalation events via a secured webhook, uses OpenAI plus Qdrant knowledge to draft an evidence-backed action plan, and routes it to Slack for human approval before writing a guarded private note back to Zendesk, while tracking state in PostgreSQL and caching snapshots in Redis.
How it works
- Receives a POST webhook event containing an eventId and Zendesk ticketId, validates the payload, and loads tenant deployment configuration from PostgreSQL.
- Atomically claims the event in PostgreSQL for idempotent processing, acknowledges the request, and fetches the current Zendesk ticket.
- Loads a short-lived redacted conversation snapshot from Redis or fetches the latest public Zendesk comments, then stores the redacted snapshot back in Redis.
- Enriches the case with account facts from PostgreSQL and runs OpenAI specialists to triage, research against tenant-approved Qdrant documents, decide a recommendation, draft a private-note action plan, and independently QA the proposal.
- Applies deterministic gating rules and either posts a manual-review alert to Slack or sends an approval message to Slack with approve/reject actions and an expiry window.
- If approved, rechecks the Zendesk ticket for changes, writes a guarded private note (and non-decreasing priority) to Zendesk, verifies the audit marker, records the outcome in PostgreSQL, and notifies Slack.
- Separately, accepts a human-reviewed case outcome via a secured webhook, confirms the Zendesk ticket is solved/closed, embeds the reviewed resolution with OpenAI, upserts it into Qdrant as approved “resolved_case” memory, and a schedule watchdog posts Slack alerts for expired approvals or stalled work.
Setup
- Provision a PostgreSQL database using the provided schema (database.sql) and configure the default deployment row in swl_escalation.deployments (Zendesk subdomain, Qdrant URL/collection, Slack channel ID, thresholds, and approval timing).
- Create a Qdrant collection with 1536 dimensions and cosine distance, add the required payload indexes (tenant_id, approved, kind), and add a Qdrant API key credential.
- Add credentials for Zendesk (HTTP Basic Auth with API token), OpenAI API, Redis, PostgreSQL, Slack bot token, and two separate Header Auth credentials for the intake and feedback webhooks.
- Create or choose a private Slack review channel, invite the Slack bot, and set the channel ID in the deployment config.
- Copy the webhook URLs for /swl-escalation-intake-v1 and /swl-escalation-feedback-v1 and configure your source systems to call them with the required headers and payloads.