SnykWebhook

Model for Snyk Webhooks (v1 API).

  1. Overview

Overview

This model represents webhooks in a Snyk organization. Webhooks allow you to receive notifications when events occur in Snyk.

Uses the Snyk v1 API endpoint: /org/{orgId}/webhooks

Usage

import clearskies
from clearskies_snyk.models.v1 import SnykWebhook


def my_handler(snyk_webhook: SnykWebhook):
    # Fetch all webhooks for an organization
    webhooks = snyk_webhook.where("org_id=org-id-123")
    for webhook in webhooks:
        print(f"Webhook: {webhook.url}")

    # Create a new webhook
    webhook = snyk_webhook
    webhook.org_id = "org-id-123"
    webhook.url = "https://my.app.com/webhook-handler/snyk"
    webhook.secret = "my-secret-key"
    webhook.save()

    # Delete a webhook
    webhook.delete()

Webhook Events

Snyk sends a ping event to newly configured webhooks so you can verify the connection. You can also manually ping a webhook using the ping endpoint.

Required Permissions

  • View Organization
  • View Outbound Webhooks
  • Create Outbound Webhooks (for creating)
  • Remove Outbound Webhooks (for deleting)