new endpoint /workflows/response
Context
- Problem: We need to handle responses from Stakwork efficiently and take the next action on the response data.
- Why it's needed: This endpoint is crucial for maintaining the integrity and accuracy of our workflow tracking system by ensuring that all responses are logged and processed correctly.
- Larger System Fit: This endpoint is part of the Stakwork Common Workflow Plumbing feature, which aims to streamline and automate workflow processes.
- Background: The
/workflows/responseendpoint will update thewf_requeststable with response data, ensuring that the status of each request is accurately tracked.
This is related to a broader project defined here: For context see: https://github.com/stakwork/sphinx-tribes/issues/1922
System Schematic:
Design
The logical flow to process a response is:
- "/workflow/response"
- On receipt of response object.
- Use requestUUID to load response data into DB wf_requests
- Create action object (union of requestObject and responseObject) POST to /workflow/action
{
"source": "string",
"requestUUID": "string",
"action": "string"
"workflowID": interger,
"formData": { object },
"responseData": { object }
}
-
Endpoint:
/workflows/response -
HTTP Method: POST
-
Request Body: JSON object containing response data from Stakwork.
- Example:
{ "request_id": "12345", "status": "completed", "response_data": { "key1": "value1", "key2": "value2" } }
- Example:
-
Database Interaction: Update the
wf_requeststable with the response data based onrequest_id. -
Database Interaction: Use the
wf_processing_mapto check for next processing action based onaction.
Task Breakdown
- [ ] Dependancy for handler: https://github.com/stakwork/sphinx-tribes/issues/1937
- [x] #1941
- [x] #1942
- [x] #1943
Assignment Criteria
- Required Knowledge/Skills:
- Proficiency in the primary programming language and framework used in the project.
- Understanding of RESTful API design and database operations.
- Communication Channels:
- Ensure you are live on Sphinx V2 for team communication.
Acceptance Criteria
- [ ] The
/workflows/responseendpoint accepts POST requests with valid JSON response data. - [ ] The endpoint updates the
wf_requeststable with the correct response data based onrequest_id. - [ ] The endpoint returns a 200 HTTP status code and a success message upon successful update.
- [ ] The endpoint returns an appropriate error message and status code for invalid requests or update failures.
- [ ] The implementation includes unit tests covering both successful and failure scenarios.
- [ ] The endpoint is documented in the API documentation.
@humansinstitute I can help?
@humansinstitute Please assign me?
@humansinstitute assign me?
This would be blocked until this ticket is merged to allow access to the wf_requests table: https://github.com/stakwork/sphinx-tribes/issues/1925
@humansinstitute, Please assign me?