AI-Powered Transform Generation

Generate transform code from natural language descriptions using Hookbase's built-in AI.

Overview

Instead of writing JSONata, JavaScript, or Liquid transforms from scratch, describe what you want in plain English and let AI generate the code for you.

Available on: Starter, Pro, and Business plans.

How It Works

  1. Click AI Generate in the Transforms page
  2. Describe what the transform should do
  3. Optionally provide a sample input payload
  4. Select the target language (JSONata, JavaScript, or Liquid)
  5. Review the generated code
  6. Apply it to a new or existing transform

Using the AI Generator

Via Dashboard

Navigate to Tools → Transforms and click the AI Generate button. Fill in:

FieldRequiredDescription
DescriptionYesPlain English description of the transform
Transform TypeYesJSONata, JavaScript, or Liquid
Sample InputNoExample webhook payload for better accuracy

Via API

curl -X POST https://api.hookbase.app/api/organizations/{orgId}/transforms/generate \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Extract customer email and order total from Stripe checkout.session.completed",
    "transformType": "jsonata",
    "sampleInput": {
      "type": "checkout.session.completed",
      "data": {
        "object": {
          "customer_email": "[email protected]",
          "amount_total": 4999,
          "currency": "usd"
        }
      }
    }
  }'

The response is streamed via SSE:

data: {"type":"token","token":"{\n"}
data: {"type":"token","token":"  \"email\": $.data.object.customer_email,\n"}
data: {"type":"token","token":"  \"total\": $.data.object.amount_total / 100\n"}
data: {"type":"token","token":"}"}
data: {"type":"done","code":"{\n  \"email\": $.data.object.customer_email,\n  \"total\": $.data.object.amount_total / 100\n}","valid":true}

Example Prompts

Here are some effective prompts to try:

PromptLanguageOutput
"Extract email and name from a Stripe customer.created event"JSONata{ "email": $.data.object.email, "name": $.data.object.name }
"Convert Shopify order to a Slack message block"JSONataStructured Slack Block Kit payload
"Filter to only include items over $50 and sum their prices"JSONataFiltered and aggregated result
"Rename all snake_case keys to camelCase"JavaScriptJS transform with key mapping
"Format as an HTML email template with order details"LiquidLiquid template with HTML

Tips for Best Results

  • Be specific: "Extract customer email from Stripe checkout" works better than "get email"
  • Provide sample data: Including a sample payload dramatically improves accuracy
  • Specify the output shape: If you know what the output should look like, describe it
  • Iterate: Generate, review, and regenerate with a refined description if needed
  • Always review: AI-generated code should be tested before using in production

Rate Limits

AI transform generation is rate-limited to 10 requests per minute per organization.

See Also