Setting Up Transformation Webhooks

This guide explains how to configure webhooks to receive notifications when your data transformations are completed.

Prerequisites

  • Your API Key
  • Your Transform ID for the transformation you want to monitor
  • YOUR WEBHOOK URL
  • YOUR WEBHOOK AUTHENTICATION KEY

Step 1: Create a Webhook

First, create a webhook by making the following API call:

Python
import requests

url = "https://api.runtrellis.com/v1/webhook"
headers = {
    "Authorization": YOUR_API_KEY,
    "accept": "application/json",
    "content-type": "application/json"
}
payload = {
    "url": YOUR_WEBHOOK_URL,
    "auth_key": YOUR_WEBHOOK_AUTH_KEY # THIS CAN BE ANY STRING IF YOU DON'T WANT HAVE AN AUTH KEY. 
}
response = requests.post(url,  json=payload, headers=headers)
YOUR_WEBHOOK_ID = response.json()["webhook_id"]

Save the webhook_id from the response for use in Step 2.

Step 2: Subscribe to Transform Completion Events

After creating the webhook, subscribe to transformation completion events using the following API call:

Python
import json

url = "https://api.runtrellis.com/v1/events/subscriptions/actions/bulk"
headers = {
    "Authorization": YOUR_API_KEY,
    "accept": "application/json",
    "content-type": "application/json"
}

payload = {
    "events_with_actions": [
        {
            "event_type": "transform_completed",
            "transform_id": YOUR_TRANSFORM_ID,
            "actions": [
                {
                    "type": "send_webhook",
                    "transform_id": YOUR_TRANSFORM_ID,
                    "webhook_id": YOUR_WEBHOOK_ID
                }
            ]
        }
    ]
}

response = requests.post(url, headers=headers, json=payload)
'

Required Replacements

Before making the API calls, replace the following placeholders with your actual values:

  • YOUR_API_URL: Your Trellis API URL
  • YOUR_API_KEY: Your Trellis API authentication key
  • YOUR_TRANSFORM_ID: The ID of the transformation you want to monitor
  • YOUR_WEBHOOK_ID: The webhook ID received from Step 1

What Happens Next?

Once configured, you will receive webhook notifications at your specified endpoint whenever the specified transformation completes. The webhook will contain details about the completed transformation.