Triggers

Enable and manage event triggers for integrations.

Triggers

Triggers listen for events from third-party services and deliver them to your callback URL. Weavz supports three trigger types: webhook (real-time push), polling (periodic checks), and app-webhook (platform-managed webhooks).

List Triggers

GET/api/v1/triggers

List all active trigger sources in your organization.

Query Parameters

FieldTypeRequiredDescription
workspaceIdstring (uuid)NoFilter triggers to one workspace
limitintegerNoNumber of triggers to return, default 50, max 100
offsetintegerNoNumber of triggers to skip for pagination

Response

json
{
  "triggers": [
    {
      "id": "t1a2b3c4-d5e6-7890-abcd-ef1234567890",
      "orgId": "550e8400-e29b-41d4-a716-446655440000",
      "triggerType": "WEBHOOK",
      "integrationName": "github",
      "triggerName": "new_push",
      "workspaceId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "workspaceIntegrationId": "7df5c03e-4df5-4b5f-95a7-5277d8f972db",
      "webhookUrl": "https://api.weavz.io/api/v1/webhooks/github/abc123",
      "callbackUrl": "https://your-app.com/webhooks/github-push",
      "simulate": false,
      "createdAt": "2025-01-15T10:30:00.000Z",
      "lastDelivery": null
    }
  ],
  "total": 1
}

Example

bash
curl https://api.weavz.io/api/v1/triggers \
  -H "Authorization: Bearer wvz_your_api_key"

Enable Trigger

POST/api/v1/triggers/enable

Enable a trigger to start receiving events.

Request Body

FieldTypeRequiredDescription
integrationNamestringYesIntegration name (e.g., github, slack)
triggerNamestringYesTrigger name (e.g., new_push, new_message)
callbackUrlstring (uri)YesURL to receive trigger events
callbackHeadersobjectNoCustom headers to include with callback requests
callbackMetadataobjectNoMetadata passed through with each callback
connectionExternalIdstringNoA connection's externalId selector. Use this when you want to select one connection directly.
workspaceIdstring (uuid)YesWorkspace scope for connection resolution and partials
workspaceIntegrationIdstring (uuid)NoConfigured workspace integration instance to target. Prefer this when the same integration has multiple aliases.
integrationAliasstringNoWorkspace integration alias to target when workspaceIntegrationId is not provided.
endUserIdstringNoThe end user's externalId for per-user connection resolution
inputobjectNoTrigger configuration values. Defaults and partials are merged before the trigger is enabled
partialIdsstring[]NoPartial IDs to apply. If omitted, default partials auto-resolve. Send [] to run without defaults.
pollingIntervalMinutesnumberNoPolling interval in minutes (1-1440). Only applies to polling triggers. Minimum interval depends on your plan.
simulatebooleanNoEnable simulation mode for testing

Use workspaceIntegrationId or integrationAlias to select the configured alias whose connection strategy and partial defaults should apply.

Response (201)

json
{
  "triggerSource": {
    "id": "t1a2b3c4-d5e6-7890-abcd-ef1234567890",
    "orgId": "550e8400-e29b-41d4-a716-446655440000",
    "triggerType": "WEBHOOK",
    "integrationName": "github",
    "triggerName": "new_push",
    "workspaceId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "workspaceIntegrationId": "7df5c03e-4df5-4b5f-95a7-5277d8f972db",
    "integrationAlias": "github_prod",
    "webhookUrl": "https://api.weavz.io/api/v1/webhooks/github/abc123",
    "callbackUrl": "https://your-app.com/webhooks/github-push",
    "createdAt": "2025-01-15T10:30:00.000Z"
  }
}

Example

bash
curl -X POST https://api.weavz.io/api/v1/triggers/enable \
  -H "Authorization: Bearer wvz_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "integrationName": "github",
    "triggerName": "new_push",
    "callbackUrl": "https://your-app.com/webhooks/github-push",
    "integrationAlias": "github_prod",
    "workspaceId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "input": {
      "repo": "my-org/my-repo"
    }
  }'

For webhook triggers, the response includes a webhookUrl that you need to register in the third-party service. For polling triggers, Weavz automatically checks for new data at regular intervals.

Errors

StatusCodeDescription
400VALIDATION_ERRORMissing required fields
403POLLING_INTERVAL_TOO_SHORTPolling interval below plan minimum
404TRIGGER_NOT_FOUNDTrigger not found on the integration

Disable Trigger

POST/api/v1/triggers/disable

Disable an active trigger and stop receiving events.

Request Body

FieldTypeRequiredDescription
triggerSourceIdstring (uuid)YesID of the trigger source to disable

Response

json
{
  "disabled": true,
  "triggerSourceId": "t1a2b3c4-d5e6-7890-abcd-ef1234567890"
}

Example

bash
curl -X POST https://api.weavz.io/api/v1/triggers/disable \
  -H "Authorization: Bearer wvz_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"triggerSourceId": "t1a2b3c4-d5e6-7890-abcd-ef1234567890"}'

Errors

StatusCodeDescription
400MISSING_IDMissing trigger source ID
404NOT_FOUNDTrigger source not found

Test Trigger

POST/api/v1/triggers/test

Get sample data for a trigger to understand its event payload format.

Request Body

FieldTypeRequiredDescription
integrationNamestringYesIntegration name
triggerNamestringYesTrigger name

Response

json
{
  "sampleData": {
    "ref": "refs/heads/main",
    "repository": {
      "full_name": "owner/repo"
    },
    "commits": [
      {
        "id": "abc123",
        "message": "Update README"
      }
    ]
  }
}

Example

bash
curl -X POST https://api.weavz.io/api/v1/triggers/test \
  -H "Authorization: Bearer wvz_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"integrationName": "github", "triggerName": "new_push"}'

Errors

StatusCodeDescription
400MISSING_FIELDSMissing required fields
404INTEGRATION_NOT_FOUNDIntegration not found
404TRIGGER_NOT_FOUNDTrigger not found