Product Update

Generate Webhook Transforms with AI

Describe your transform in plain English and let AI generate JSONata, JavaScript, or Liquid code. Load sample payloads, auto-validate, and test before saving.

Hookbase Team
5 min read

Stop Writing Transforms by Hand

Writing JSONata expressions, JavaScript transforms, or Liquid templates from scratch is tedious -- especially when you are dealing with complex nested payloads from ERP systems, payment processors, or e-commerce platforms. Fields wrapped in { Value: "..." } objects, stringified JSON buried inside other JSON, inconsistent casing across properties. Getting it right takes trial and error.

Today we are shipping AI-powered transform generation. Describe what you want in plain English, and Hookbase generates syntactically valid transform code for you.

How It Works

In the transform builder, click the Generate with AI button. A modal opens where you can:

  1. Describe your transform -- Write what you need in natural language
  2. Load a sample payload -- Click "Load recent event" to pull the most recent webhook payload from your sources
  3. Choose the language -- JSONata, JavaScript, or Liquid
  4. Generate -- Watch the code stream in real-time

Here is an example prompt:

"Extract the customer email, order total, and line items from a Stripe checkout.session.completed webhook. Flatten the line items into an array of objects with name, quantity, and amount."

The AI analyzes your description and sample payload, then produces working code that matches the exact field names and structure of your data.

Smart Features

Auto-Validation and Retry

Every generated transform is validated immediately after generation. If there is a syntax error -- a missing bracket, an invalid JSONata expression, a malformed Liquid tag -- the AI automatically retries with the error context and produces a corrected version. You see a "Fixing syntax errors..." message while this happens.

Test Before Saving

Click Test with sample to execute the generated code against your sample input right in the modal. You see the transformed output (or any runtime errors) before committing. If the result is not what you expected, click Regenerate to try again with the same prompt.

Load Recent Events

Instead of copy-pasting payloads from your webhook provider's documentation, click Load recent event to fetch the most recent real payload from your sources. This ensures the AI sees the exact field names, types, and structure of your actual data -- not some idealized example.

Handling Complex Payloads

The AI is prompted to recognize patterns common in real-world webhooks:

  • Wrapped values -- Many business systems wrap fields in objects like { Value: "actual_value" }. The AI uses field?.Value to extract them.
  • Nested JSON strings -- Some payloads contain stringified JSON in a field (e.g., data.Data is a JSON string). The AI applies JSON.parse() to access the nested data.
  • Comma-separated strings -- Fields like "1,2,5" are split with .split(',').map(s => s.trim()).
  • Case-sensitive matching -- Field names are matched exactly as they appear in your sample: TemplateIds stays TemplateIds, not templateIds.

Example: Purchase Order Transform

Given a complex PO webhook payload with nested order lines, shipping addresses, and contact information, a prompt like:

"Extract PO number, customer ID, status, line items with SKU and quantity, ship-to address, and the last template ID from the comma-separated TemplateIds string"

Produces a complete JavaScript transform that parses nested JSON, maps over order lines, extracts the ship-to address, and splits the template IDs string to grab the last one.

Availability

AI transform generation is available on Starter plans and above. The feature uses Claude for code generation, ensuring high-quality output across all three transform languages.

Get started by opening any transform and clicking Generate with AI, or create a new transform and let the AI write the first draft.

product-updateaitransformsjsonatajavascriptliquidwebhooks

Ready to Try Hookbase?

Start receiving, transforming, and routing webhooks in minutes.

Get Started Free