Installation
Install the plugin using npm:Configuration & Parameters
Parameters
The name of the job or event that will trigger the egress process. This must correspond to an
operation
name defined in an action in your workbook configuration (e.g., ‘workbook:submitActionFg’).The URL of the webhook endpoint where the workbook data will be sent. If not provided, the plugin will use the value from the
WEBHOOK_SITE_URL
environment variable.Default Behavior
When thewebhookUrl
parameter is not provided during initialization, the plugin will look for an environment variable named WEBHOOK_SITE_URL
and use its value as the destination for the data. If neither the parameter nor the environment variable is set, the request will fail. The plugin sends data as a JSON payload in an HTTP POST request with Content-Type: application/json
.
Usage Examples
Basic Usage
Explicit Webhook URL Configuration
Webhook Response with Rejections
The plugin can process responses from your webhook that contain data rejections. If your webhook performs validation and finds errors, it can return them in a specific JSON format, and the plugin will display these errors in the Flatfile UI.Troubleshooting
Common Error Messages
“Failed to submit data to [webhook]”- Check that the webhook URL is correct
- Verify the server is running and accessible
- Ensure the webhook is not returning error status codes (4xx or 5xx)
- Check for network connectivity issues
- Verify DNS resolution for the webhook URL
- Confirm the webhook URL is properly formatted
- Your webhook returns a 200 OK status but the response body is not valid JSON
- Ensure your endpoint returns
Content-Type: application/json
- Return at least an empty JSON object
{}
if no specific response is needed
Error Handling Patterns
The plugin handles errors internally and reports them as job outcomes:- Non-200 HTTP status codes: The job completes with a failure message showing the status code
- Network errors: The job fails with a generic “Error posting data to webhook” message
- Invalid JSON responses: The job completes with a success status but warns about parsing issues
Notes
Requirements and Limitations
- An action must be configured in the workbook with an
operation
that matches thejob
string passed to the plugin - The webhook endpoint must accept POST requests with
Content-Type: application/json
- The entire workbook’s data (all sheets and all records) is sent in a single request, which may result in large payloads for extensive workbooks
Dependencies
- The plugin depends on
@flatfile/plugin-job-handler
for job lifecycle management (bundled with the plugin) - Uses
@flatfile/util-response-rejection
for processing webhook rejection responses - Utilizes
@flatfile/util-common
for error logging
Validation Flow
The plugin supports a two-way validation flow where your webhook can return validation errors in therejections
format. These errors are automatically processed and displayed in the Flatfile UI, allowing users to see and correct data issues identified by your backend systems.