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
- Click AI Generate in the Transforms page
- Describe what the transform should do
- Optionally provide a sample input payload
- Select the target language (JSONata, JavaScript, or Liquid)
- Review the generated code
- 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:
| Field | Required | Description |
|---|---|---|
| Description | Yes | Plain English description of the transform |
| Transform Type | Yes | JSONata, JavaScript, or Liquid |
| Sample Input | No | Example 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:
| Prompt | Language | Output |
|---|---|---|
| "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" | JSONata | Structured Slack Block Kit payload |
| "Filter to only include items over $50 and sum their prices" | JSONata | Filtered and aggregated result |
| "Rename all snake_case keys to camelCase" | JavaScript | JS transform with key mapping |
| "Format as an HTML email template with order details" | Liquid | Liquid 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
- Transforms Guide — Manual transform creation
- Transforms API — Full API reference
- Pipeline Architecture — How transforms fit in the pipeline