V4 - logHelpIssueTool¶
A utility workflow that logs user help requests to a PostgreSQL database and returns a unique reference ID for tracking purposes.
Purpose¶
No business context provided yet — add a context.md to enrich this documentation.
This workflow serves as a centralized logging mechanism for help requests across different channels. When users encounter issues or need assistance, other workflows can call this tool to create a permanent record in the database with all relevant context information.
How It Works¶
- Receives Help Request Data: Another workflow triggers this tool with user information and issue details
- Stores in Database: The request is inserted into the
v4_helprequeststable with a timestamp - Returns Reference ID: A unique reference ID is generated and returned for tracking the request
The workflow is designed to be called by other workflows rather than running independently, making it a reusable component for help request logging across the system.
Mermaid Diagram¶
graph TD
A[When Executed by Another Workflow] --> B[Insert Help Request]
B --> C[Return Result]
Trigger¶
Execute Workflow Trigger: This workflow is designed to be called by other workflows, not triggered directly by external events.
Required Input Parameters:¶
phoneNumber: User's phone numberchannel: Communication channel (e.g., WhatsApp, SMS, web)issue_description: Description of the user's issue or help requestsession_snapshot: JSON object containing session context and state information
Nodes Used¶
| Node Type | Node Name | Purpose |
|---|---|---|
| Execute Workflow Trigger | When Executed by Another Workflow | Receives input parameters from calling workflows |
| PostgreSQL | Insert Help Request | Stores the help request data in the database |
| Code | Return Result | Formats and returns the success response with reference ID |
External Services & Credentials Required¶
PostgreSQL Database¶
- Credential Name:
sifaV4Dev - Required Permissions: INSERT access to
v4_helprequeststable - Database Schema: Must contain
v4_helprequeststable with columns:phonenumber(text)channel(text)issue_description(text)session_snapshot(jsonb)created_at(timestamp)id(auto-incrementing primary key)
Environment Variables¶
No environment variables are used in this workflow. All configuration is handled through n8n credentials and node parameters.
Data Flow¶
Input¶
1 2 3 4 5 6 | |
Output¶
1 2 3 4 | |
The reference ID follows the format HELP- followed by the database-generated ID number.
Error Handling¶
This workflow has minimal error handling:
- Database connection errors will cause the workflow to fail
- Invalid JSON in session_snapshot will cause the PostgreSQL insert to fail
- If the database insert fails, no reference ID will be returned
The calling workflow should implement appropriate error handling for failed executions.
Known Limitations¶
- No input validation on required fields
- No duplicate request detection
- Database errors are not gracefully handled
- Reference ID generation assumes successful database insert
Related Workflows¶
This workflow is designed to be called by other workflows that handle user interactions and need to log help requests. Check for workflows that use the "Execute Workflow" node targeting this workflow.
Setup Instructions¶
-
Import the Workflow
- Copy the workflow JSON
- Import into your n8n instance
-
Configure Database Credentials
- Create a PostgreSQL credential named
sifaV4Dev - Ensure connection to database with
v4_helprequeststable
- Create a PostgreSQL credential named
-
Create Database Table (if not exists)
1 2 3 4 5 6 7 8
CREATE TABLE v4_helprequests ( id SERIAL PRIMARY KEY, phonenumber TEXT, channel TEXT, issue_description TEXT, session_snapshot JSONB, created_at TIMESTAMP DEFAULT NOW() ); -
Test the Workflow
- Use the "Execute Workflow" node from another workflow
- Pass test data with all required parameters
- Verify database insert and reference ID return
-
Activate the Workflow
- Set the workflow to active status
- Ensure it's available for other workflows to call