title

Introduction

In this tutorial, we’ll build a proactive error tracking system for your product. Instead of waiting for customers to report issues, this system automatically detects errors, identifies the affected user, determines which team member should handle the issue, and sends appropriate notifications.

What We’ll Build

  • A system that listens for errors on both frontend and backend
  • Logic to identify which product line, user, and type of error occurred
  • Automatic assignment to the appropriate developer based on the error source
  • Immediate alert emails to both the support team and affected customer
  • Database tracking for all issues with their resolution status

Prerequisites

  • A WorqHat account (sign up at worqhat.com)
  • Basic understanding of API requests
  • A frontend application to integrate with (we’ll provide sample code)

Step 1: Create a Database Table

  1. Sign in to your WorqHat account and select your workspace
  2. Navigate to the Database section
  3. Create a new table called “user_issue_data” with the following columns:
    • Document ID (automatically generated as primary key)
    • user_id (string, not nullable)
    • user_email (string, not nullable)
    • description (string, nullable)
    • issue_date (date, not nullable)
    • issue_priority (string, not nullable)
    • assigned_person (string, nullable)
    • resolved_status (boolean, default: false)

Step 2: Create the Workflow

  1. Navigate to the Workflows section and click “Create Workflow”
  2. Name your workflow “Error Tracker”
  3. Select “URL based request” as the trigger type

Configure Workflow Input Parameters

The workflow will receive the following parameters from your application:

  • user_id
  • user_email
  • error_name
  • issue_id
  • code_segment (identifies where the error occurred: ‘workflows’, ‘AI’, or ‘no_code’)

Step 2.1: Store Data in Database

  1. Add a “Store Data” action
  2. Configure it to store in your “user_issue_data” collection
  3. Map the input fields to your database columns by clicking on each field and selecting the appropriate variable from the dropdown list:
    • Document ID: Click the field and select issue_id from the input variables
    • user_id: Click the field and select userId from the input variables
    • user_email: Click the field and select userEmail from the input variables
    • description: Click the field and select errorName from the input variables
    • issue_priority: Type “high” or click to create logic to determine priority
    • resolved_status: Select “false” from the boolean options

Step 2.2: Send Email to Customer

  1. Add a “Send Email” action
  2. Configure the email by clicking on each field and selecting variables where appropriate:
    • From: Click and select errors@worqhat.com (or your custom domain)
    • To: Click the field and select userEmail from the input variables
    • CC: Click and enter support@worqhat.com
    • Subject: Click and enter “We noticed an error while you were using our product”
    • Body: Click the text editor and draft a message notifying the customer that you’ve detected an error and are actively working to resolve it. You can include variables by clicking the + button and selecting from available variables.

Step 2.3: Create Switch Case for Error Source

  1. Add a “Switch Case” action
  2. Click the condition field and select codeSegment from the input variables
  3. Create three cases by clicking “Add Case”:
    • Case 1: Enter ‘workflows’
    • Case 2: Enter ‘AI’
    • Case 3: Enter ‘no_code’
  4. Add a default case by clicking “Add Default Case”

Step 2.4: Configure Team Notifications

For each case in the switch statement:

  1. Click the “Add Action” button within the case and select “Send Email”
  2. Configure the email to go to the appropriate team member:
  3. For the subject, click and enter “Error Alert: [Error Type] Error”
  4. For the body, click the text editor and include relevant details by clicking the + button to add variables:
    • User ID: Select userId from input variables
    • User email: Select userEmail from input variables
    • Error name: Select errorName from input variables
    • Issue ID: Select issueId from input variables

Step 2.5: Configure Return Value

For each case:

  1. Click the “Add Action” button and select “Return”
  2. Click the return value field and select issueId from input variables to confirm successful processing

Step 3: Test the Workflow

  1. Click the “Test” button in the workflow editor
  2. In the test panel, enter sample values for all required parameters:
    • userId: “user123”
    • userEmail: “test@example.com
    • errorName: “NullPointerException”
    • issueId: “issue456”
    • codeSegment: “workflows”
  3. Toggle on “Developer Mode” to see detailed execution steps
  4. Click “Run Test” and verify that emails are sent and data is stored correctly

Step 4: Integrate with Your Application

Create an API Key

  1. Navigate to API Keys in your WorqHat dashboard
  2. Create a new API key
  3. Whitelist the domains that will be calling your workflow

Frontend Integration

curl -X POST \
  'https://api.worqhat.com/flows/trigger/YOUR_WORKFLOW_ID' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "userId": "user123",
    "userEmail": "user@example.com",
    "errorName": "NullPointerException",
    "issueId": "issue456",
    "codeSegment": "workflows"
  }'

Add buttons to your HTML to trigger these functions:

<button id="aiErrorBtn">Track AI Issue</button>
<button id="workflowsErrorBtn">Track Workflow Issue</button>
<button id="noCodeErrorBtn">Track No-Code Issue</button>

Important Notes

Security

  • Always whitelist domains that will be calling your workflow
  • Use API keys with appropriate permissions
  • Consider implementing additional authentication for sensitive operations

Scalability

WorqHat workflows run in separate containers, providing:

  • High scalability for handling multiple parallel requests
  • Enhanced security through isolation
  • Improved performance

Extending the System

You can enhance this error tracking system by:

  1. Adding severity levels to prioritize issues
  2. Implementing automatic issue assignment based on team member availability
  3. Creating a dashboard to visualize error trends
  4. Setting up automatic follow-ups for unresolved issues
  5. Integrating with other communication channels like Slack or Microsoft Teams

Conclusion

You’ve built a proactive error tracking system that helps you identify and resolve issues before they significantly impact your users. This approach transforms support from reactive to proactive, improving customer satisfaction and product reliability.

This tutorial demonstrates just one of many ways to use WorqHat Workflows. The platform’s flexibility allows you to build complex automation systems without writing extensive backend code.

Remember to secure your API keys and only whitelist domains that need access to your workflows.


Was this page helpful?