> ## 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-egress

> A plugin for egressing data from a Flatfile Workbook to a webhook.

<CardGroup cols={1}>
  <Card title="@flatfile/plugin-webhook-egress" icon="download">
    <br />

    The `@flatfile/plugin-webhook-egress` plugin egresses Flatfile Workbooks to a
    webhook.

    <br />

    <br />

    **Event Type:**

    <br />

    `listener.on('{jobParam}')` (i.e. `listener.on('workbook:submitActionFg')`)
  </Card>
</CardGroup>

## Parameters

<ParamField path="job" type="string" required>
  The `job` parameter takes the job name.
</ParamField>

<ParamField path="url" type="string" required>
  The `url` parameter takes the webhook url.
</ParamField>

## Imported NPM Packages

* [`@flatfile/api@1.7.4+`](https://www.npmjs.com/package/@flatfile/api)
* [`@flatfile/listener@1.0.1+`](https://www.npmjs.com/package/@flatfile/listener)
* [`@flatfile/plugin-job-handler@0.4.1+`](https://www.npmjs.com/package/@flatfile/plugin-job-handler)
* [`@flatfile/util-common@1.0.3+`](https://www.npmjs.com/package/@flatfile/util-common)
* [`@flatfile/util-response-rejection@1.2.4+`](https://www.npmjs.com/package/@flatfile/util-response-rejection)
* [`node-fetch@3.3.2+`](https://www.npmjs.com/package/node-fetch)

## Usage

The `webhookEgress` plugin creates an action that will export workbook data via a webhook.
It requires an operation parameter which specifies the event that will initiate the egress. The
webhook url can either be passed in as a parameter or set as an environment variable `WEBHOOK_SITE_URL`.

```bash install
npm i @flatfile/plugin-webhook-egress @flatfile/listener
```

![workbook\_actions\_primary](https://github.com/FlatFilers/Guides/assets/19697744/c747495a-19e9-4333-88f3-e94239cfe47b)

```ts workbook.config.json
  // ... inside Workbook configuration
  "actions": [
    {
      operation: 'submitActionFg',
      mode: 'foreground',
      label: 'Send to...',
      type: 'string',
      description: 'Submit this data to a webhook.',
      primary: true,
    }
  ]
  // ...
```

```ts listener.js
import type { FlatfileListener } from "@flatfile/listener";
import { webhookEgress } from "@flatfile/plugin-webhook-egress";

export default function (listener: FlatfileListener) {
  listener.use(
    webhookEgress("workbook:submitActionFg", "https://webhook.site/...")
  );
}
```

## See the code

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