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, the purpose of a trigger is to convert third-party events into an input format that Dify can recognize and process.new email event receiver in Gmail, every time you receive a new email, Gmail automatically sends an event to Dify that can be used to 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.
Technical Overview
Dify triggers are implemented based on webhooks, a widely adopted mechanism across the web. Many mainstream SaaS platforms (like GitHub, Slack, and Linear) support webhooks with comprehensive developer documentation. A webhook can be understood as an HTTP-based event dispatcher. Once an event-receiving address is configured, these SaaS platforms automatically push event data to the target server 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: Webhook-based event dispatch requires registering Dify’s network address on a third-party platform’s developer console as the target server. In Dify, this configuration process is called a Subscription.
- Event: A platform may send multiple types of events—such as email received, email deleted, or email marked as read—all of which are pushed to the registered address. A trigger plugin can handle multiple event types, with each event corresponding to a plugin trigger node in a Dify workflow.
Plugin Development
The development process for a trigger plugin is consistent with that of other plugin types (Tool, Data Source, Model, etc.). You can create a development template using thedify plugin init command. The generated file structure follows the standard plugin format specification.
-
manifest.yaml: Describes the plugin’s basic metadata. -
providerdirectory: Contains the provider’s metadata, the code for creating subscriptions, and the code for classifying events after receiving webhook requests. -
eventsdirectory: 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, the minimum required Dify version must be set to
1.10.0, and the SDK version must be >= 0.6.0.Subscription Creation
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.
github.yaml and github.py.
- github.yaml
- github.py
Since GitHub webhooks use an encryption mechanism, a secret key is required to decrypt and validate incoming requests. Therefore, you need to declare
webhook_secret in github.yaml.Event Handling
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, you can define the event and its implementation throughevents/issues/issues.yaml and events/issues/issues.py, respectively. The event’s output can be defined in the output_schema section of issues.yaml, which follows the same JSON Schema specification as tool plugins.
- issues.yaml
- issues.py
Event Filtering
To filter out certain events—for example, to focus only on Issue events with a specific label—you can addparameters to the event definition in issues.yaml. Then, in the _on_event method, you can throw an EventIgnoreError exception to filter out events that do not meet the configured criteria.
- issues.yaml
- issues.py
Subscription Creation via OAuth or API Key
To enable automatic subscription creation via OAuth or API key, you need to modify thegithub.yaml and github.py files.
- github.yaml
- github.py
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 required credentials for creating a subscription with an API key or access token, such asaccess_tokensfor GitHub. -
oauth_schema(optional): Required for implementing 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. Automatic subscription creation via OAuth can also be implemented in the same
Constructor class: by adding an oauth_schema field under subscription_constructor, you can enable OAuth authentication.

Explore More
The interface definitions and implementation methods of core classes in trigger plugin development are as follows.Trigger
TriggerSubscriptionConstructor
Event
Edit this page | Report an issue