TableFlow uses webhooks to push real-time notifications for your data imports. For example, you can use webhooks on TableFlow to get notified when a user completes a file import:

  1. Your user imports a CSV or Excel file using the embedded TableFlow importer on your web app
  2. TableFlow notifies your system, via a webhook, that a data import has been completed
  3. The webhook will contain the column definitions and other information about the import
Once a webhook is received, the row data should be retrieved using the API.

Configure your application to receive webhooks

To get started, create an endpoint where you can receive webhooks. For this example, we’ll use Svix Play to easily set up a test endpoint.

1. Create an endpoint

Go to play.svix.com and copy the provided URL that will receive webhooks. You can also provide your own endpoint URL instead.

Svix Play

2. Add the endpoint to TableFlow

Navigate to your workspace settings in the TableFlow admin app. Under the “Webhooks” section, there is where we’ll add the endpoint we just created and choose the import.completed event to be notified when users complete a file import:

Add Endpoint

3. Send a test event

Send a test event to your webhook by navigating to the “Testing” tab, selected the event to send, and pressing “Send Example”:

Testing

You’ll be able to see the webhook received on Svix Play, and under the “Logs” tab of the webhooks settings:

Logs

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!

Transforming and filtering webhooks

You can use the transformations feature to modify the payload of webhooks or cancel it entirely based on data in the payload.

To add a transformation, select “Enable” and “Edit transformation” under the “Advanced” tab of an endpoint:

Transformations

Transform

You can use transformations to modify the payload to be in the format you need, or add additional parameters.

Transformations

function handler(webhook) {
  webhook.payload.myExtraProperty = 'Foo';
  return webhook;
}

Filter

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):

Transformations

function handler(webhook) {
  if (webhook.payload.metadata?.environment !== 'development') {
    webhook.cancel = true;
  }
  return webhook;
}