Skip to content

feat: add OpenSupports ticketing provider (pull + webhook + notify, 80 tests)#6173

Open
chengyixu wants to merge 1 commit intokeephq:mainfrom
chengyixu:feat/opensupports-provider-v2
Open

feat: add OpenSupports ticketing provider (pull + webhook + notify, 80 tests)#6173
chengyixu wants to merge 1 commit intokeephq:mainfrom
chengyixu:feat/opensupports-provider-v2

Conversation

@chengyixu
Copy link
Copy Markdown

Summary

Adds a native Keep provider for OpenSupports, an open-source self-hosted customer support ticketing system.

Closes #5225

Features

Pull mode

Fetches open tickets via GET /api/staff/get-all-tickets with automatic pagination (50/page):

  • Maps ticket priority (1–4 numeric or low/medium/high/critical strings) → AlertSeverity
  • Maps status (open/pending/waiting → FIRING, closed/resolved → RESOLVED)
  • Extracts department name and owner into alert labels
  • Parses both Unix epoch and ISO 8601 timestamps

Push (webhook) mode

Receives ticket events from OpenSupports HTTP webhook notifications:

  • Handles single events, wrapped {"ticket": ...} payloads, and JSON arrays
  • webhook_markdown includes step-by-step OpenSupports setup guide

Action methods

  • create_ticket(title, content, department_id?, priority?, email?, name?) — create new ticket
  • close_ticket(ticket_number) — close ticket by number
  • add_reply(ticket_number, content) — add staff reply/comment

_notify() integration

Maps Keep severity strings → OpenSupports priority integers:

  • critical → 4, high → 3, warning/medium → 2, low/info → 1

validate_scopes()

Tests connectivity, tickets:read, and tickets:write access independently.

Tests: 80 unit tests

  • Auth config validation (all fields, verify_ssl)
  • URL helpers and Authorization header
  • PRIORITY_SEVERITY_MAP and STATUS_MAP constants (all 13 entries)
  • _ticket_to_alert_dto guards and non-crash coverage
  • _format_alert edge cases (empty list, non-dict items)
  • _get_alerts pagination, short-page stop, error handling
  • create_ticket (required fields, all optional fields, error propagation)
  • close_ticket and add_reply action methods
  • _notify() all severity levels → priority mapping
  • _query() status param, pagination, empty result
  • HTTP layer: URL construction, 403 errors, network errors, empty response body
  • webhook_markdown placeholders
  • validate_config

Why Better Than Existing PR

Supersedes #5579 (163 lines, no test file, no webhook mode, no action methods) with:

  • Comprehensive pull + push + notify + 3 action methods
  • 80 unit tests (vs 0)
  • Full pagination support
  • Full priority→severity + status→AlertStatus mapping
  • SSL verification option for self-signed certificates

/claim #5225

…0 unit tests

Implements a native Keep provider for OpenSupports (https://www.opensupports.com/),
an open-source self-hosted customer support ticketing system. Closes keephq#5225.

Features:
- Pull mode: fetch open tickets from OpenSupports REST API as AlertDtos
- Push (webhook) mode: receive ticket creation/update events in real time
- notify(): create support tickets programmatically with severity->priority mapping
- create_ticket(), close_ticket(), add_reply() action methods
- _query(): paginated ticket search by status
- validate_scopes(): connectivity + read/write permission checks
- Full priority->severity mapping (1-4 numeric + string labels)
- Full status->AlertStatus mapping (open/pending/waiting->FIRING, closed/resolved->RESOLVED)
- Pagination support (50 tickets per page, auto-stops on short page)
- SSL verification flag for self-signed certificate environments
- 80 unit tests covering auth config, HTTP helpers, scope validation,
  MAP constants, all action methods, _notify severity mapping, webhook markdown,
  error propagation, and edge cases

Supersedes PR keephq#5579 (163 lines, no tests) with comprehensive implementation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 29, 2026

@chengyixu is attempting to deploy a commit to the KeepHQ Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. Feature A new feature Provider Providers related issues labels Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🙋 Bounty claim Feature A new feature Provider Providers related issues size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🔌 Provider]: OpenSupports

1 participant