Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webhook egress #765

Merged
merged 5 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions plugins/egress/webhook.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
title: "@flatfile/plugin-webhook-egress"
description: "A plugin for egressing data from a Flatfile Workbook to a webhook."
icon: "download"
---

<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="webhookUrl" type="string">
The `webhookUrl` parameter takes the webhook url.
</ParamField>

## Imported NPM Packages

- [`@flatfile/[email protected]+`](https://www.npmjs.com/package/@flatfile/api)
- [`@flatfile/[email protected]+`](https://www.npmjs.com/package/@flatfile/listener)
- [`@flatfile/[email protected]+`](https://www.npmjs.com/package/@flatfile/plugin-job-handler)
- [`@flatfile/[email protected]+`](https://www.npmjs.com/package/@flatfile/util-common)
- [`[email protected]+`](https://www.npmjs.com/package/axios)

## Usage

The `webhookEgress` plugin 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`.

```SSH install
npm i @flatfile/plugin-webhook-egress
```

```ts import
import { webhookEgress } from "@flatfile/plugin-webhook-egress";
```

```ts listener.js
listener.use(webhookEgress("workbook:submitActionFg"));
```

## 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"
></Card>
</CardGroup>
2 changes: 1 addition & 1 deletion plugins/export/workbook.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ listener.use(exportWorkbookPlugin());

<CardGroup cols={2}>
<Card
title="@flatfile/plugin-xlsx-extractor"
title="@flatfile/plugin-export-workbook"
href="https://github.com/FlatFilers/flatfile-plugins/tree/main/plugins/export-worbook"
icon="github"
></Card>
Expand Down