Note: this code runs successfully in Node.js version v20.19.4
API documentation: https://www.browseract.com/reception/integrations/api-workflow
Site: https://www.browseract.com
- Node.js 14 or higher
- npm (comes with Node.js)
- Install Node.js from nodejs.org
- Verify installation:
node --version npm --version
-
Navigate to the Workflow-NodeJs directory:
cd Workflow-NodeJs -
Install dependencies (if any):
npm install
# Run specific example
npm run run-task
npm run stop-task
npm run get-task
npm run get-task-status
npm run list-tasks
npm run list-workflows
npm run get-workflow# Run specific example
node 1.runTask.js
node 2.stopTask.js
node 3.getTask.js
node 4.getTaskStatus.js
node 5.listTasks.js
node 6.listWorkflows.js
node 7.getWorkflow.js
node 8.resumeTask.js
node 9.runTaskByTemplate.js
node 11.listOfficialWorkflowTemplates.js
node 12.getRegionList.jsWorkflow-NodeJs/
├── package.json # Node.js dependencies and scripts
├── README.md # This file
├── 1.runTask.js # Start a new workflow task
├── 2.stopTask.js # Permanently terminate a task
├── 3.getTask.js # Get detailed task information
├── 4.getTaskStatus.js # Get task status only
├── 5.listTasks.js # List all workflow tasks
├── 6.listWorkflows.js # List all workflows
├── 7.getWorkflow.js # Get workflow details
├── 8.resumeTask.js # Resume a paused task
├── 9.runTaskByTemplate.js # Start a new workflow task using template
├── 11.listOfficialWorkflowTemplates.js # List official workflow templates
└── 12.getRegionList.js # Get supported region list
| File | Description | API Endpoint |
|---|---|---|
1.runTask.js |
Start a new workflow task (custom workflow) | POST /v2/workflow/run-task |
9.runTaskByTemplate.js |
Start a new workflow task using official template | POST /v2/workflow/run-task-by-template |
2.stopTask.js |
Permanently terminate a task | PUT /v2/workflow/stop-task |
8.resumeTask.js |
Resume a paused task | PUT /v2/workflow/resume-task |
3.getTask.js |
Get detailed task information | GET /v2/workflow/get-task |
4.getTaskStatus.js |
Get task status only | GET /v2/workflow/get-task-status |
5.listTasks.js |
List all workflow tasks | GET /v2/workflow/list-tasks |
| File | Description | API Endpoint |
|---|---|---|
6.listWorkflows.js |
List all custom workflows | GET /v2/workflow/list-workflows |
7.getWorkflow.js |
Get workflow details | GET /v2/workflow/get-workflow |
11.listOfficialWorkflowTemplates.js |
List official workflow templates | GET /v2/workflow/list-official-workflow-templates |
| File | Description | API Endpoint |
|---|---|---|
12.getRegionList.js |
Get supported region list for proxy | GET /v2/workflow/get-region-list |
Before running the examples, you need to:
- Get your API key from: https://www.browseract.com/reception/integrations
- Get your workflow ID from: https://www.browseract.com/reception/workflow-list
- Update the following variables in each example file:
authorization: Replace"app-abcdefghijklmn"with your actual API keyworkflowId: Replace1234567890with your actual workflow IDtaskId: Replace the actual task ID returned by 1.runTask.js
Important: The examples use placeholder API keys for demonstration purposes. In production:
- Never hardcode API keys in your source code
- Use environment variables or secure configuration files
- Keep your API keys confidential and rotate them regularly
Example of using environment variables:
const authorization = process.env.BROWSERACT_API_KEY;All examples include comprehensive error handling for:
- Network connectivity issues
- API authentication errors
- Invalid parameters
- Server errors
- Node.js Built-in Modules: Uses
httpsmodule for HTTP requests - JSON: Built-in JSON parsing for API responses
- Node.js Version Error: Ensure Node.js 14+ is installed
- Module Not Found: Verify you're in the correct directory
- API Error 401: Check your API key and ensure it's valid
- API Error 10118: Verify the workflow ID exists and is accessible with your API key
- API Documentation: https://www.browseract.com/reception/integrations/api-workflow
- Support: Contact us via discord or email: support@browseract.com
- GitHub Issues: Report bugs or request features
This demo code is provided as-is for educational and development purposes.