[PR #24693] feat: add app trigger list api #30750

Closed
opened 2026-02-21 20:48:09 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/24693

State: closed
Merged: Yes


Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

image

To add a trigger list and enable/disable trigger API
the backend of this issue https://github.com/langgenius/dify/issues/24198

Get all the triggers of an app

curl -X GET 'http://127.0.0.1:5001/console/api/apps/1c507f65-eacf-41af-9836-5e858dfa7bcc/triggers'

response:

{
  "data": [
    {
      "id": "0198ee75-e4a9-7f68-b61a-faaa44298049",
      "trigger_type": "trigger-webhook",
      "title": "Webhook 触发器",
      "node_id": "1756347350195",
      "provider_name": "",
      "icon": null,
      "status": "disabled",
      "created_at": "2025-08-28T02:16:00.422856",
      "updated_at": "2025-08-28T02:13:37.891350"
    },
    {
      "id": "0198ee75-769e-7099-85a2-9d126bbb667d",
      "trigger_type": "trigger-schedule",
      "title": "定时触发器",
      "node_id": "1756284529768",
      "provider_name": "",
      "icon": null,
      "status": "disabled",
      "created_at": "2025-08-28T02:15:32.245169",
      "updated_at": "2025-08-28T02:13:37.891350"
    }
  ]
}

Enable/Disable a trigger

curl -X POST 'http://127.0.0.1:5001/console/api/apps/1c507f65-eacf-41af-9836-5e858dfa7bcc/trigger-enable' -H 'Content-Type: application/json' -d '{
  "trigger_id": "0198ee75-e4a9-7f68-b61a-faaa44298049",
  "enable_trigger": true
}'
{
  "id": "0198ee75-e4a9-7f68-b61a-faaa44298049",
  "trigger_type": "trigger-webhook",
  "title": "Webhook 触发器",
  "node_id": "1756347350195",
  "provider_name": "",
  "icon": null,
  "status": "enabled",
  "created_at": "2025-08-28T02:16:00.422856",
  "updated_at": "2025-08-28T02:13:37.891350"
}

Main Updates:

  • Introduced a new database table named app_triggers.
  • Implemented logic to extract trigger node data and save it to the app_triggers table whenever a workflow app is published.

Additional Updates:

  • Replaced uuid v4 with uuidv7 for all trigger-related tables
  • Resolved the issue of separation in the database migration file.
  • Renamed the node webhook to trigger-webhook for improved clarity.
  • Added a webhook-debug-url to prepare develop debug.
  • Migrated from flask-restful to flask-restx

Screenshots

Before After
... ...

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/24693 **State:** closed **Merged:** Yes --- > [!IMPORTANT] > > 1. Make sure you have read our [contribution guidelines](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) > 1. Ensure there is an associated issue and you have been assigned to it > 1. Use the correct syntax to link this PR: `Fixes #<issue number>`. ## Summary <img width="480" height="237" alt="image" src="https://github.com/user-attachments/assets/2e22ed10-9e24-43df-99f9-9052414b02f9" /> To add a trigger list and enable/disable trigger API the backend of this issue https://github.com/langgenius/dify/issues/24198 #### Get all the triggers of an app ``` curl -X GET 'http://127.0.0.1:5001/console/api/apps/1c507f65-eacf-41af-9836-5e858dfa7bcc/triggers' ``` response: ``` { "data": [ { "id": "0198ee75-e4a9-7f68-b61a-faaa44298049", "trigger_type": "trigger-webhook", "title": "Webhook 触发器", "node_id": "1756347350195", "provider_name": "", "icon": null, "status": "disabled", "created_at": "2025-08-28T02:16:00.422856", "updated_at": "2025-08-28T02:13:37.891350" }, { "id": "0198ee75-769e-7099-85a2-9d126bbb667d", "trigger_type": "trigger-schedule", "title": "定时触发器", "node_id": "1756284529768", "provider_name": "", "icon": null, "status": "disabled", "created_at": "2025-08-28T02:15:32.245169", "updated_at": "2025-08-28T02:13:37.891350" } ] } ``` #### Enable/Disable a trigger ``` curl -X POST 'http://127.0.0.1:5001/console/api/apps/1c507f65-eacf-41af-9836-5e858dfa7bcc/trigger-enable' -H 'Content-Type: application/json' -d '{ "trigger_id": "0198ee75-e4a9-7f68-b61a-faaa44298049", "enable_trigger": true }' ``` ``` { "id": "0198ee75-e4a9-7f68-b61a-faaa44298049", "trigger_type": "trigger-webhook", "title": "Webhook 触发器", "node_id": "1756347350195", "provider_name": "", "icon": null, "status": "enabled", "created_at": "2025-08-28T02:16:00.422856", "updated_at": "2025-08-28T02:13:37.891350" } ``` ### Main Updates: - Introduced a new database table named `app_triggers`. - Implemented logic to extract trigger node data and save it to the `app_triggers` table whenever a workflow app is published. ### Additional Updates: - Replaced `uuid v4` with `uuidv7` for all trigger-related tables - Resolved the issue of separation in the database migration file. - Renamed the node `webhook` to `trigger-webhook` for improved clarity. - Added a `webhook-debug-url` to prepare develop debug. - Migrated from `flask-restful` to `flask-restx` ## Screenshots | Before | After | |--------|-------| | ... | ... | ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:48:09 -05:00
yindo closed this issue 2026-02-21 20:48:09 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#30750