> ## Documentation Index
> Fetch the complete documentation index at: https://langwatch.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a Slack alert trigger

> Create a trigger that posts to a Slack incoming webhook when traces match its filters. The `/api/triggers` family supersedes this narrower form, which stays for callers written against it.



## OpenAPI

````yaml POST /api/trigger/slack
openapi: 3.1.0
info:
  title: LangWatch API
  version: 1.0.0
  description: LangWatch openapi spec
servers:
  - url: https://app.langwatch.ai
security:
  - project_api_key: []
paths:
  /api/trigger/slack:
    post:
      tags:
        - Triggers
      summary: Create a Slack alert trigger
      description: >-
        Create a trigger that posts to a Slack incoming webhook when traces
        match its filters. The `/api/triggers` family supersedes this narrower
        form, which stays for callers written against it.
      operationId: postApiTriggerSlack
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                slack_webhook:
                  type: string
                  format: uri
                  description: Incoming webhook URL the alert is posted to
                name:
                  type: string
                  description: How the trigger is listed in the app
                message:
                  type: string
                  description: Extra line included with each alert
                filters:
                  type: object
                  required:
                    - topics.topics
                    - topics.subtopics
                    - metadata.user_id
                    - metadata.thread_id
                    - metadata.customer_id
                    - metadata.labels
                    - metadata.key
                    - metadata.value
                    - metadata.prompt_ids
                    - traces.origin
                    - traces.error
                    - traces.name
                    - spans.type
                    - spans.model
                    - evaluations.evaluator_id
                    - evaluations.evaluator_id.guardrails_only
                    - evaluations.evaluator_id.has_passed
                    - evaluations.evaluator_id.has_score
                    - evaluations.evaluator_id.has_label
                    - evaluations.passed
                    - evaluations.score
                    - evaluations.state
                    - evaluations.label
                    - events.event_type
                    - events.metrics.key
                    - events.metrics.value
                    - events.event_details.key
                    - annotations.hasAnnotation
                  properties:
                    topics.topics:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    topics.subtopics:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    metadata.user_id:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    metadata.thread_id:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    metadata.customer_id:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    metadata.labels:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    metadata.key:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    metadata.value:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    metadata.prompt_ids:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    traces.origin:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    traces.error:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    traces.name:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    spans.type:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    spans.model:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    evaluations.evaluator_id:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    evaluations.evaluator_id.guardrails_only:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    evaluations.evaluator_id.has_passed:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    evaluations.evaluator_id.has_score:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    evaluations.evaluator_id.has_label:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    evaluations.passed:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    evaluations.score:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    evaluations.state:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    evaluations.label:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    events.event_type:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    events.metrics.key:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    events.metrics.value:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    events.event_details.key:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                    annotations.hasAnnotation:
                      anyOf:
                        - type: array
                          items:
                            type: string
                        - type: object
                          additionalProperties:
                            type: array
                            items:
                              type: string
                        - type: object
                          additionalProperties:
                            type: object
                            additionalProperties:
                              type: array
                              items:
                                type: string
                  additionalProperties: false
                  default: {}
                  description: >-
                    Which traces the trigger fires on. An empty object fires on
                    all of them.
                alert_type:
                  type: string
                  enum:
                    - CRITICAL
                    - WARNING
                    - INFO
              required:
                - slack_webhook
                - name
                - alert_type
              additionalProperties: false
      responses:
        '200':
          description: The trigger was created
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Human-readable confirmation
                required:
                  - message
        '400':
          description: The body was not valid JSON, or failed validation
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  errors:
                    type: array
                    items:
                      type: object
                      additionalProperties: {}
                    description: The individual validation failures, when present
                required:
                  - message
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                required:
                  - message
        '403':
          description: The API key lacks triggers:manage
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Stable failure code; branch on this
                  message:
                    type: string
                  fault:
                    type: string
                    description: >-
                      Who the failure is attributable to: customer, platform,
                      provider
                  tips:
                    type: array
                    items:
                      type: string
                  docsUrl:
                    type: string
                required:
                  - error
                additionalProperties: true
components:
  securitySchemes:
    project_api_key:
      type: apiKey
      in: header
      name: X-Auth-Token
      description: >-
        Project API key for sending traces and accessing project-scoped
        resources. Format: sk-lw-... (no underscore). Obtain one by creating a
        project via the Admin API or the LangWatch UI.

````