id: zendesk
name: Zendesk
version: 1.0.0
description: "Zendesk Support (REST API v2) — ticketing: create, read, update and search tickets, add comments (public or internal), and list users. API-token (Basic) authentication; stdlib-only, no extra Python dependencies."
changelog: "1.0.0 — Initial release: create/get/update/search tickets, add comment, list users."
category: ticketing

# Per-instance configuration. Auth is HTTP Basic with '<email>/token:<api_token>'.
config_schema:
  properties:
    subdomain:
      type: string
      description: "Zendesk subdomain (the X in https://X.zendesk.com)"
    email:
      type: string
      description: "Agent email address"
    api_token:
      type: string
      description: "Zendesk API token"
      x-soar-sensitive: true
  required:
    - subdomain
    - email
    - api_token

commands:
  - id: create_ticket
    name: zendesk-create-ticket
    description: "Create a ticket."
    inputs_schema:
      properties:
        subject: { type: string, description: "Ticket subject" }
        comment: { type: string, description: "Initial comment / description" }
        priority: { type: string, description: "low, normal, high, or urgent" }
        type: { type: string, description: "problem, incident, question, or task" }
        tags: { type: string, description: "Comma-separated tags" }
        requester_email: { type: string, description: "Requester email (optional)" }
      required: [subject, comment]
    outputs_schema: { properties: {} }
  - id: get_ticket
    name: zendesk-get-ticket
    description: "Get a ticket by ID."
    risk: read
    inputs_schema:
      properties:
        ticket_id: { type: string, description: "Ticket ID" }
      required: [ticket_id]
    outputs_schema: { properties: {} }
  - id: update_ticket
    name: zendesk-update-ticket
    description: "Update a ticket (status, priority, or assignee)."
    inputs_schema:
      properties:
        ticket_id: { type: string, description: "Ticket ID" }
        status: { type: string, description: "new, open, pending, hold, solved, or closed" }
        priority: { type: string, description: "low, normal, high, or urgent" }
        assignee_id: { type: string, description: "Assignee user ID" }
      required: [ticket_id]
    outputs_schema: { properties: {} }
  - id: search_tickets
    name: zendesk-search-tickets
    description: "Search tickets with a Zendesk search query."
    risk: read
    inputs_schema:
      properties:
        query: { type: string, description: "Search query (e.g. status:open priority:high)" }
      required: [query]
    outputs_schema: { properties: {} }
  - id: add_comment
    name: zendesk-add-comment
    description: "Add a comment to a ticket (public or internal note)."
    inputs_schema:
      properties:
        ticket_id: { type: string, description: "Ticket ID" }
        comment: { type: string, description: "Comment body" }
        public: { type: boolean, description: "Public comment (default true; false = internal note)" }
      required: [ticket_id, comment]
    outputs_schema: { properties: {} }
  - id: list_users
    name: zendesk-list-users
    description: "List users (optionally filter by role)."
    risk: read
    inputs_schema:
      properties:
        role: { type: string, description: "Optional role filter (end-user, agent, admin)" }
      required: []
    outputs_schema: { properties: {} }

  - id: test_connection
    name: zendesk-test-connection
    description: "Verify connectivity and credentials (used by the Test button)."
    risk: read
    inputs_schema:
      properties: {}
      required: []
    outputs_schema: { properties: {} }
