Skip to main content

What Is a Trigger Plugin?

Triggers were introduced in Dify v1.10.0 as a new type of start node. Unlike functional nodes such as Code, Tool, or Knowledge Retrieval, a trigger converts third-party events into an input format that Dify can recognize and process.
Trigger Plugin Intro
For example, if you configure Dify as the new email event receiver in Gmail, Gmail automatically sends an event to Dify every time you receive a new email, and that event can trigger a workflow. However:
  • Gmail’s original event format is not compatible with Dify’s input format.
  • There are thousands of platforms worldwide, each with its own unique event format.
Trigger plugins close this gap: they define and parse events from different platforms and unify them into an input format that Dify can accept.

Technical Overview

Dify triggers are built on webhooks, a widely adopted mechanism across the web. Mainstream SaaS platforms such as GitHub, Slack, and Linear support webhooks and document them thoroughly. A webhook is an HTTP-based event dispatcher: once you configure an event-receiving address, the platform automatically pushes event data to that address whenever a subscribed event occurs. To handle webhook events from different platforms in a unified way, Dify defines two core concepts: Subscription and Event.
  • Subscription: The configuration that registers Dify’s network address as the target server in a third-party platform’s developer console.
  • Event: A platform may send multiple types of events (such as email received, email deleted, or email marked as read), all pushed to the registered address. A trigger plugin can handle multiple event types, and each event corresponds to a Plugin Trigger node in a Dify workflow.

Plugin Development

Developing a trigger plugin follows the same process as other plugin types (Tool, Data Source, Model, and so on). Create a development template with the dify plugin init command. The generated file structure follows the standard plugin format specification.
  • manifest.yaml: Describes the plugin’s basic metadata.
  • provider directory: Contains the provider’s metadata, the code for creating subscriptions, and the code for classifying events after receiving webhook requests.
  • events directory: Contains the code for event handling and filtering, which supports local event filtering at the node level. You can create subdirectories to group related events.
For trigger plugins, set the minimum required Dify version to 1.10.0 and the SDK version to >= 0.6.0.
The following sections use GitHub as an example to walk through the development process.

Create a Subscription

Webhook configuration methods vary significantly across mainstream SaaS platforms:
  • Some platforms (such as GitHub) support API-based webhook configuration. For these platforms, once OAuth authentication is completed, Dify can automatically set up the webhook.
  • Other platforms (such as Notion) do not provide a webhook configuration API and may require users to perform manual authentication.
To accommodate these differences, we divide the subscription process into two parts: the Subscription Constructor and the Subscription itself. For platforms like Notion, creating a subscription requires the user to manually copy the callback URL provided by Dify and paste it into their Notion workspace to complete the webhook setup. This process corresponds to the Paste URL to create a new subscription option in the Dify interface.
Paste URL to Create a New Subscription
To support subscription creation via manual URL pasting, modify two files: github.yaml and github.py.
GitHub webhooks use an encryption mechanism, so a secret key is required to decrypt and validate incoming requests. Declare webhook_secret in github.yaml.

Handle Events

Once an event is extracted, the corresponding implementation must filter the original HTTP request and transform it into an input format that Dify workflows can accept. Taking the Issue event as an example, define the event in events/issues/issues.yaml and its implementation in events/issues/issues.py. Define the event’s output in the output_schema section of issues.yaml, which follows the same JSON Schema specification as tool plugins.

Filter Events

To filter out certain events (for example, to focus only on Issue events with a specific label), add parameters to the event definition in issues.yaml. Then, in the _on_event method, raise an EventIgnoreError exception for events that don’t meet the configured criteria.

Create Subscriptions via OAuth or API Key

To enable automatic subscription creation via OAuth or API key, modify the github.yaml and github.py files.
In github.yaml, add the following fields.
subscription_constructor is a concept abstracted by Dify to define how a subscription is constructed. It includes the following fields:
  • parameters (optional): Defines the parameters required to create a subscription, such as the event types to subscribe to or the target GitHub repository.
  • credentials_schema (optional): Declares the credentials required to create a subscription with an API key or access token, such as access_tokens for GitHub.
  • oauth_schema (optional): Required for subscription creation via OAuth. For details on how to define it, see Add OAuth Support to Your Tool Plugin.

Once you have modified these two files, you’ll see the Create with API Key option in the Dify interface. The same Constructor class also supports automatic subscription creation via OAuth: add an oauth_schema field under subscription_constructor to enable OAuth authentication.
OAuth & API Key Options

Explore More

The interface definitions for the core classes in trigger plugin development are as follows.

Trigger

TriggerSubscriptionConstructor

Event

Last modified on June 24, 2026