> ## Documentation Index
> Fetch the complete documentation index at: https://flatfileinc-feat-updatereactquickstart.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# @flatfile/plugin-webhook-event-forwarder

> A plugin to forward Flatfile Events to specified http endpoints for headless workflows.

<Warning>
  When embedding Flatfile, this plugin should be deployed in a server-side.
</Warning>

<CardGroup cols={1}>
  <Card title="@flatfile/plugin-webhook-event-forwarder" icon="download">
    The `@flatfile/plugin-webhook-event-forwarder"` plugin listens for Flatfile
    Events and forwards them to a given endpoint via webhook. This allows for
    language-agnostic processing of Flatfile Events and allows for receiving
    data back from the given endpoint for robust processing workflows.
  </Card>
</CardGroup>

## Parameters

<ParamField path="url" type="string">
  The URL to send the webhook requests to. If not specified it will attempt to
  get the URL from your environment file. If not specified through either method
  it will fail.
</ParamField>

<ParamField path="callback" type="function">
  A callback to run after the request completes. If the callback returns data,
  it will be included in the `job:outcome-acknowledged` event generated by the
  request competion.
</ParamField>

## API Calls

* `api.events.create`

## Imported NPM Packages

* [`@flatfile/api@1.5.37`](https://www.npmjs.com/package/@flatfile/api) is the
  official Flatfile SDK for JavaScript.

* [`@flatfile/cross-env-config@0.0.3`](https://www.npmjs.com/package/@flatfile/cross-env-config)
  is a utility for getting environement variables.

* [`@flatfile/listener@0.3.17`](https://www.npmjs.com/package/@flatfile/listener)
  is a library for listening to Flatfile Events.

* [`@types/express@4.17.21`](https://www.npmjs.com/package/@types/express) types
  for Express.

* [`axios@1.6.1`](https://www.npmjs.com/package/axios) is a tool for making
  webhook requests.

## Usage

For workflows which process Flatfile Events outside of the listener file, use
the desired endpoint that the webhooks are to be sent to. For testing, use a
basic `webhook.site` endpoint.

```bash install
npm i @flatfile/plugin-webhook-event-forwarder
```

```ts
import { webhookEventForward } from "@flatfile/plugin-webhook-event-forwarder";
```

```ts listener.ts
listener.use(
  webhookEventForward("https://webhook.site/yourwebhooksitehere", (data) => {
    //do stuff here
  })
);
```

## See the code

<CardGroup cols={2}>
  <Card title="@flatfile/plugin-webhook-event-forwarder" href="https://github.com/FlatFilers/flatfile-plugins/tree/main/plugins/webhook-event-forwarder" icon="github" />
</CardGroup>
