Webhooks
Learn how to use webhooks to get notified when Tensorlake Jobs finishes.
You can use webhooks to get notified by Tensorlake when -
- A Document Ingestion Job finishes with a success or failure status.
- When a Serverless Workflow finishes running for a given Input.
Scope of Webhook Endpoints
Webhooks are configured on a per-project basis. The project associated with the API key that is being used to configure the webhook is the one for which the webhook will be triggered.
Document Ingestion Webhook Payload
The following payload is sent to your configured webhook URL when a job finishes.
The following statuses are possible -
success
- The job finished successfully.failure
- The job failed to finish.processing
- The job is still processing.
Webhook Configuration
You can configure your webhook URL by calling the Configure Webhook API.
- Create an API Key.
- Invoke the Configure Webhook API with the API Key.
You will receive a response with a URL to configure the webhook. We use Svix to deliver webhooks at the moment.
- Open the URL in a browser, and configure the webhook endpoint.
Paste the URL into the Endpoint URL
field, and click Save
. By default, all events for the project
will be delivered to the webhook URL.
Testing Webhooks
Svix have a convenient UI to test webhooks.
Configure a Play
endpoint on Svix, and then call the Tensorlake API to parse a document,
and see it delivered to your play endpoint. Hit the with Svix Play
link and it would
populate a test endpoint in the Endpoint URL
field.
Document Ingestion Webhook Payload
The following payload is sent to your configured webhook URL when a job finishes.
If a Parse job is created without a dataset, the dataset
field will be null
.
The possible statuses are -
success
- The job finished successfully.failure
- The job failed to finish.processing
- The job is still processing.
Serverless Workflow Webhook Payload
The following payload is sent to your configured webhook URL when all functions of a Serverless Workflow finishes running for a given Input.
The following statuses are possible for each function -
success
- The function finished running successfully.failure
- The function failed to finish running.
Example
Once you have configured the webhook, test it with this example snippet.
- It parses a document, and sets
deliver_webhook
toTrue
. - Once the parsing is complete, you should see the webhook payload delivered to your configured webhook URL.
We highly recommend using Svix Play to test whether webhooks are getting delivered.
Was this page helpful?