Skip to content

Commit 23221ae

Browse files
committed
Updated webhooks docs
1 parent 1efdee2 commit 23221ae

File tree

7 files changed

+48
-5
lines changed

7 files changed

+48
-5
lines changed

docs/api-reference/get-import.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
2-
title: "Get Import Metadata"
2+
title: "Get Import"
33
openapi: "GET /import/{id}"
44
---
Loading
Loading
315 KB
Loading

docs/mint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@
9292
{
9393
"group": "API",
9494
"pages": [
95-
"api-reference/get-import-rows",
9695
"api-reference/get-import",
96+
"api-reference/get-import-rows",
9797
"api-reference/download-import",
9898
"api-reference/create-importer",
9999
"api-reference/delete-importer"

docs/retrieve-data.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ onComplete: (data) => console.log(data)
1616

1717
<Info>Feature available in <a href="https://tableflow.com/pricing" target="_blank">TableFlow Cloud</a>.</Info>
1818

19-
TableFlow provides an API to paginate the row data of an import, view metadata about an import, or download an import directly as a CSV.
19+
TableFlow provides an API to retrieve import data, paginate the row data of an import (used for large imports), or download an import directly as a CSV.
2020

21+
- [Get Import](/api-reference/get-import)
2122
- [Get Import Rows](/api-reference/get-import-rows)
22-
- [Get Import Metadata](/api-reference/get-import)
2323
- [Download Import CSV](/api-reference/download-import)
2424

2525
You can also use [Webhooks](/webhooks) to get notified when an import has been completed. This allows your backend application to load the imported data as soon as an import has completed.

docs/webhooks.mdx

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ TableFlow uses webhooks to push real-time notifications about your data imports.
88

99
1. Your user imports a CSV or Excel file using the embedded TableFlow importer on your web app
1010
2. TableFlow notifies your system, via a webhook, that a data import has been completed
11-
3. Your system can use the API to [paginate through the imported data](/api-reference/get-import-rows), or [download the data directly as a CSV file](/api-reference/download-import).
11+
3. The webhook will contain the row data, column definitions, and other information about the import
12+
13+
<Info>The number of rows included is limited to 10,000. If there are more than 10,000 rows, an `error` will be set and the data should be retrieved using the [API](/api-reference/get-import-rows).</Info>
1214

1315
## Configure your application to receive webhooks
1416

@@ -39,3 +41,44 @@ You’ll be able to see the webhook received on [Svix Play](https://play.svix.co
3941
</Frame>
4042

4143
After configuring your application to receive webhooks, all subscribed events will be sent to the endpoint. You can now import a file to test out your new webhook!
44+
45+
## Transforming and filtering webhooks
46+
47+
You can use the transformations feature to modify the payload of webhooks or cancel it entirely based on data in the payload.
48+
49+
To add a transformation, select "Enable" and "Edit transformation" under the "Advanced" tab of an endpoint:
50+
<Frame>
51+
![Transformations](/assets/webhooks-transformations.jpg)
52+
</Frame>
53+
54+
#### Transform
55+
56+
You can use transformations to modify the payload to be in the format you need, or add additional parameters.
57+
58+
<Frame>
59+
![Transformations](/assets/webhooks-transformations-transform.jpg)
60+
</Frame>
61+
62+
```javascript
63+
function handler(webhook) {
64+
webhook.payload.myExtraProperty = 'Foo';
65+
return webhook;
66+
}
67+
```
68+
69+
#### Filter
70+
71+
To filter webhooks from being sent to an endpoint, you just need to set `webhook.cancel = true`. In this example we filter webhooks to an endpoint based on the import `metadata` (a parameter you can provide the [SDK](/sdk/react#properties)):
72+
73+
<Frame>
74+
![Transformations](/assets/webhooks-transformations-filter.jpg)
75+
</Frame>
76+
77+
```javascript
78+
function handler(webhook) {
79+
if (webhook.payload.metadata?.environment !== 'development') {
80+
webhook.cancel = true;
81+
}
82+
return webhook;
83+
}
84+
```

0 commit comments

Comments
 (0)