Skip to content

Weekly Report Conversation Handler - Optimized

This workflow serves as an optimized bridge between n8n and a FastAPI service for handling weekly report conversations. It receives conversation data (phone number, message, channel) from other workflows, forwards it to a FastAPI webhook endpoint, and returns structured conversation state information including response output, stage transitions, and closure status.

Purpose

No business context provided yet — add a context.md to enrich this documentation.

How It Works

  1. Receives Input: The workflow is triggered by another n8n workflow with conversation parameters including phone number, message, channel, base URL, and webhook token
  2. Calls FastAPI Service: Makes a POST request to the FastAPI weekly report webhook endpoint, sending the phone number and message as JSON payload
  3. Processes Response: Extracts key conversation state data from the FastAPI response including output message, stage information, and closure status
  4. Returns Structured Data: Formats and returns the processed conversation data for use by the calling workflow

Workflow Diagram

graph TD
    A[When Executed by Another Workflow] --> B[Call Weekly Report FastAPI]
    B --> C[Return Output]

Trigger

Execute Workflow Trigger: This workflow is designed to be called by other n8n workflows. It expects the following input parameters: - phoneNumber: The user's phone number - message: The conversation message content - channel: Communication channel identifier - baseUrl: Base URL for the FastAPI service - webHookToken: Authentication token for the webhook

Nodes Used

Node Type Node Name Purpose
Execute Workflow Trigger When Executed by Another Workflow Receives input parameters from calling workflows
HTTP Request Call Weekly Report (FastAPI) Makes POST request to FastAPI webhook endpoint
Set Return Output Structures and formats the response data

External Services & Credentials Required

FastAPI Service: - Requires a running FastAPI service with a weekly report webhook endpoint - Endpoint pattern: {baseUrl}/webhooks/n8n/weekly-report/{webHookToken} - No additional credentials needed beyond the webhook token passed as parameter

Environment Variables

This workflow doesn't use environment variables directly. All configuration is passed through input parameters: - Base URL and webhook token are provided by the calling workflow - No static environment configuration required

Data Flow

Input Parameters: - phoneNumber (string): User's phone number - message (string): Conversation message - channel (string): Communication channel - baseUrl (string): FastAPI service base URL - webHookToken (string): Webhook authentication token

Output Data: - output (string): Response message from the conversation handler - nextStage (string): Next conversation stage identifier - shouldClose (boolean): Whether the conversation should be closed - phoneNumber (string): Original phone number (passed through) - previousStage (string): Previous conversation stage identifier

Error Handling

The workflow uses basic HTTP request error handling through the n8n HTTP Request node. If the FastAPI service is unavailable or returns an error, the workflow will fail and stop execution. No custom error handling or retry logic is implemented.

Known Limitations

  • No retry mechanism for failed API calls
  • Depends on external FastAPI service availability
  • No input validation for required parameters
  • Error responses from FastAPI service are not handled gracefully

This workflow is designed to be called by other conversation handling workflows but no specific related workflows are identified in the current configuration.

Setup Instructions

  1. Import Workflow: Import the JSON workflow definition into your n8n instance

  2. Configure FastAPI Service: Ensure you have a compatible FastAPI service running with the weekly report webhook endpoint

  3. Test Connection: Verify the FastAPI service is accessible and the webhook endpoint responds correctly

  4. Integration: Call this workflow from other n8n workflows using the Execute Workflow node, providing all required input parameters:

    1
    2
    3
    4
    5
    6
    7
    {
      "phoneNumber": "+1234567890",
      "message": "User message content",
      "channel": "whatsapp",
      "baseUrl": "https://your-fastapi-service.com",
      "webHookToken": "your-webhook-token"
    }
    

  5. Activate Workflow: Ensure the workflow is activated in n8n to accept incoming execution requests

  6. Monitor Execution: Check workflow execution logs to verify successful communication with the FastAPI service