@bunnarin/plugin-workflow-endpoint
v1.0.3
Published
This plugin extends the `@nocobase/plugin-workflow` with an **Endpoint Trigger** and a **Response Instruction**. It allows you to trigger workflows via HTTP requests and return custom responses directly to the caller.
Readme
@bunnarin/plugin-workflow-endpoint
Description
This plugin extends the @nocobase/plugin-workflow with an Endpoint Trigger and a Response Instruction.
It allows you to trigger workflows via HTTP requests and return custom responses directly to the caller.
Features
- Endpoint Trigger: Execute workflows by calling a specific endpoint URL.
- Response Instruction: Control the HTTP response (body and status code) from the workflow.
1. Create an Endpoint Workflow
- Go to Workflow in the Admin UI.
- Click Create Workflow.
- Set the Type to Endpoint. (if you don't see it, just docker restart the container)
- Give it a unique Title (e.g.,
My Public API). - Enable the workflow.
2. Configure the Trigger
- Add an Endpoint node to your workflow.
- Configure the Title to match the workflow title you set above.
- (Optional) Configure the Method (GET, POST, PUT, DELETE).
3. Configure the Response
there are only 2 way to set the response node: either hardcode it and use no variable or inject a single variable. so I suggest you use a JSON node or a JS node to create the json and then pass it to the response.
4. Call the Endpoint
Use the following URL format:
/api/workflows.endpoint:execute?title=YourWorkflowTitleSecurity
- By default, endpoints are public (no authentication required).
- You can use the
x-roleheader to specify a role:
curl -X POST http://localhost:13000/api/workflows.endpoint.execute?title=MyPublicAPI \
-H "x-role: admin" \
-H "Content-Type: application/json" \
-d '{"name": "John"}'License
MIT
