Skip to main content

Documentation Index

Fetch the complete documentation index at: https://www.plain.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Using TypeScript? Check out our GraphQL SDK for a fully typed client.
Creating a webhook target registers a new HTTP endpoint that Plain will deliver events to. You must pass:
  • url — the endpoint Plain should POST to
  • description — a short human-readable label (shown in the Plain app)
  • isEnabled — whether deliveries should start immediately
  • eventSubscriptions — the list of event types this target should receive
  • version — the webhook schema version to pin to (we recommend always pinning to a specific version)
The full list of subscribable event types is available via the subscriptionEventTypes query, or in the webhooks reference.
Mutation
mutation createWebhookTarget($input: CreateWebhookTargetInput!) {
  createWebhookTarget(input: $input) {
    webhookTarget {
      id
      url
      description
      version
      isEnabled
      eventSubscriptions {
        eventType
      }
    }
    error {
      message
      type
      code
      fields {
        field
        message
        type
      }
    }
  }
}
Variables
{
  "input": {
    "url": "https://example.com/webhooks/plain",
    "description": "Production webhook handler",
    "isEnabled": true,
    "version": "2024-04-01",
    "eventSubscriptions": [
      { "eventType": "thread.thread_created" },
      { "eventType": "thread.thread_status_transitioned" }
    ]
  }
}