Skip to main content

News Search (Simplified)

Before/after comparison: how new CEL functions simplify workflow expressions. This is a manual workflow that fetches news, checks results, and returns a summary.

manual http before-after new-functions present step_ok step_data url_params truncate tpl join_present step_has_content

Download ZIP

What's Included

FieldValue
NameNews Search (Simplified)
TypeWorkflow
Triggermanual
Steps2
Inputs2

Full JSON

Click to expand
{
"description": "Before/after comparison: how new CEL functions simplify workflow expressions. This is a manual workflow that fetches news, checks results, and returns a summary.",
"tags": [
"manual",
"http",
"before-after",
"new-functions",
"present",
"step_ok",
"step_data",
"url_params",
"truncate",
"tpl",
"join_present",
"step_has_content"
],
"notes": {
"before_after_comparisons": [
{
"pattern": "Presence check",
"before": "size(trim(coalesce(query, \"\"))) > 0",
"after": "present(query)"
},
{
"pattern": "Step success check",
"before": "get(step(0), \"executionContext.status\") == \"completed\" && (get(step(0), \"status\") == null || get(step(0), \"status\") == 200)",
"after": "step_ok(0)"
},
{
"pattern": "Step data access",
"before": "get(step(0), \"data.articles\", [])",
"after": "step_data(0, \"articles\", [])"
},
{
"pattern": "URL construction",
"before": "\"https://api.example.com/search?q=\" + encode_uri(query) + \"&maxrecords=\" + coalesce(max_records, \"50\") + \"&format=json\"",
"after": "url_params(\"https://api.example.com/search\", {\"q\": query, \"maxrecords\": coalesce(max_records, \"50\"), \"format\": \"json\"})"
},
{
"pattern": "Array slicing",
"before": "size(results) >= 3 ? [results[0], results[1], results[2]] : results",
"after": "slice(results, 0, 3)"
},
{
"pattern": "Step error extraction",
"before": "coalesce(get(step(0), \"executionContext.safeError.code\"), \"UNKNOWN\")",
"after": "get(step_error(0), \"code\", \"UNKNOWN\")"
},
{
"pattern": "String truncation",
"before": "coalesce(get(article, \"title\"), \"\")[0:math_clamp(size(coalesce(get(article, \"title\"), \"\")), 0, 80)]",
"after": "truncate(get(article, \"title\", \"\"), 80)"
},
{
"pattern": "Template interpolation",
"before": "\"*\" + get(article, \"title\", \"\") + \"*\\n\" + get(article, \"domain\", \"\") + \"\\n\" + get(article, \"url\", \"\")",
"after": "tpl(\"*{title}*\\n{domain}\\n{url}\", article)"
},
{
"pattern": "Conditional text assembly",
"before": "(present(category) ? category + \" - \" : \"\") + title",
"after": "join_present(\" - \", category, title)"
},
{
"pattern": "Step success + data check",
"before": "step_ok(0) && present(step_data(0, \"articles\"))",
"after": "step_has_content(0, \"articles\")"
}
]
},
"document": {
"name": "News Search (Simplified)",
"enabled": true,
"log_level": "info",
"trigger": {
"type": "manual"
},
"workflowInput": [
{
"name": "query",
"description": "Search query",
"schema": {
"type": "string",
"required": true
}
},
{
"name": "max_records",
"description": "Max results (default: 10)",
"schema": {
"type": "string",
"required": false
}
}
],
"steps": [
{
"condition": {
"expr": "present(query)",
"onFailure": "throw",
"resultType": "any"
},
"action": {
"actionType": "actions/network/http/request/send",
"actions/network/http/request/send": {
"method": "GET",
"url": {
"expr": "url_params(\"https://api.example.com/search\", {\"q\": query, \"maxrecords\": coalesce(max_records, \"10\"), \"format\": \"json\"})",
"onFailure": "throw",
"resultType": "any"
},
"headers": [],
"returnBuffer": false,
"cache": true
}
}
},
{
"condition": {
"expr": "step_has_content(0, \"articles\")",
"onFailure": "throw",
"resultType": "any"
},
"action": {
"actionType": "actions/ai/llm/chat/generate",
"actions/ai/llm/chat/generate": {
"is_advanced": false,
"text": {
"expr": "'Summarize these articles:\\n' + json_stringify(slice(step_data(0, \"articles\", []), 0, 3))",
"onFailure": "throw",
"resultType": "any"
}
}
}
}
],
"returnExpression": {
"expr": "step_ok(1) ? step_data(1, \"choices.0.message.content\", \"\") : get(step_error(0), \"code\", \"UNKNOWN_ERROR\")"
}
}
}

How to Import

  1. Download the ZIP file using the button above
  2. Navigate to Company Settings → Data Transfer in your AutoTalk dashboard
  3. Click Import and select the downloaded ZIP file
  4. Review the import summary and confirm
  5. All document IDs are automatically remapped — no manual ID editing needed