Climate News Options To Contact
Manual workflow that fetches five climate-related GDELT news articles, sends them as interactive contact options, and returns the full article text after the contact selects one.
Download ZIP · 2.1 KB
Before You Import
The URLs in this example use a https://<your-gdelt-proxy> placeholder that you must replace with a service you host:
- Step 1 calls
<your-gdelt-proxy>/docwith GDELT DOC 2.0 query parameters (query,mode=ArtList,maxrecords,format=json) and expects a JSON response with anarticlesarray where each article has atitleand aurl. This matches what GDELT's publichttps://api.gdeltproject.org/api/v2/doc/docendpoint returns, so your proxy can forward this call as-is. - The option actions call
<your-gdelt-proxy>/doc/contentwith aurlparameter and expect a JSON response with atextfield containing the extracted article body (an optionaltitlefield is used as a heading when present). GDELT's public API has no article-text-extraction endpoint, so your service must implement this part itself (for example, by fetching the article URL and extracting its readable text).
If you only need the article listing without full text, see Fetch GDELT Public News (Encoded String), which calls GDELT's public API directly.
Full JSON
Click to expand
{
"description": "Manual workflow that fetches five climate-related GDELT news articles, sends them as interactive contact options, and returns the full article text after the contact selects one.",
"tags": [
"manual",
"messaging",
"options",
"news",
"gdelt",
"contact",
"interactive"
],
"document": {
"name": "Climate News Options To Contact",
"enabled": true,
"log_level": "info",
"trigger": {
"type": "manual"
},
"workflowInput": [
{
"name": "contact",
"description": "Contact to receive the news options",
"schema": {
"type": "ref",
"required": true,
"enableEnums": false,
"enum": [],
"ref": "contacts"
}
}
],
"steps": [
{
"condition": {
"expr": "true",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/network/http/request/send",
"actions/network/http/request/send": {
"method": "GET",
"url": {
"expr": "\"https://<your-gdelt-proxy>/doc?query=climate&mode=ArtList&maxrecords=5&format=json\"",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"headers": [],
"returnBuffer": false,
"cache": false
}
}
},
{
"condition": {
"expr": "present(contact) && step_ok(0) && size(step_data(0, \"articles\", [])) >= 5",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/contact/send",
"actions/messaging/contact/send": {
"use_manual_id": true,
"contactId_manual": {
"expr": "contact",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"messages": [
{
"type": "options",
"payload": {
"title": {
"expr": "\"Top 5 Climate News\"",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"description": {
"expr": "\"Choose one option to receive the complete story text.\"",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"options": [
{
"label": {
"expr": "substring(coalesce(step(0).data.articles[0].title, \"News 1\"), 0, 24)",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"value": {
"expr": "coalesce(step(0).data.articles[0].url, \"\")",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"actions": [
{
"condition": {
"expr": "present(coalesce(trigger.value, contactMessage.body.value))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/network/http/request/send",
"actions/network/http/request/send": {
"method": "GET",
"url": {
"expr": "url_params(\"https://<your-gdelt-proxy>/doc/content\", {\"url\": coalesce(trigger.value, contactMessage.body.value)})",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"headers": [],
"returnBuffer": false,
"cache": false
}
}
},
{
"condition": {
"expr": "step_ok(0) && present(step_data(0, \"text\"))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "(present(step_data(0, \"title\")) ? step_data(0, \"title\") + \"\\n\\n\" : \"\") + step_data(0, \"text\", \"\")",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
},
{
"condition": {
"expr": "!step_ok(0) || blank(step_data(0, \"text\"))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "\"I couldn't fetch the full story right now. Try another option in a moment.\"",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
}
],
"forwardMessageToAgent": false
},
{
"label": {
"expr": "substring(coalesce(step(0).data.articles[1].title, \"News 2\"), 0, 24)",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"value": {
"expr": "coalesce(step(0).data.articles[1].url, \"\")",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"actions": [
{
"condition": {
"expr": "present(coalesce(trigger.value, contactMessage.body.value))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/network/http/request/send",
"actions/network/http/request/send": {
"method": "GET",
"url": {
"expr": "url_params(\"https://<your-gdelt-proxy>/doc/content\", {\"url\": coalesce(trigger.value, contactMessage.body.value)})",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"headers": [],
"returnBuffer": false,
"cache": false
}
}
},
{
"condition": {
"expr": "step_ok(0) && present(step_data(0, \"text\"))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "(present(step_data(0, \"title\")) ? step_data(0, \"title\") + \"\\n\\n\" : \"\") + step_data(0, \"text\", \"\")",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
},
{
"condition": {
"expr": "!step_ok(0) || blank(step_data(0, \"text\"))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "\"I couldn't fetch the full story right now. Try another option in a moment.\"",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
}
],
"forwardMessageToAgent": false
},
{
"label": {
"expr": "substring(coalesce(step(0).data.articles[2].title, \"News 3\"), 0, 24)",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"value": {
"expr": "coalesce(step(0).data.articles[2].url, \"\")",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"actions": [
{
"condition": {
"expr": "present(coalesce(trigger.value, contactMessage.body.value))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/network/http/request/send",
"actions/network/http/request/send": {
"method": "GET",
"url": {
"expr": "url_params(\"https://<your-gdelt-proxy>/doc/content\", {\"url\": coalesce(trigger.value, contactMessage.body.value)})",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"headers": [],
"returnBuffer": false,
"cache": false
}
}
},
{
"condition": {
"expr": "step_ok(0) && present(step_data(0, \"text\"))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "(present(step_data(0, \"title\")) ? step_data(0, \"title\") + \"\\n\\n\" : \"\") + step_data(0, \"text\", \"\")",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
},
{
"condition": {
"expr": "!step_ok(0) || blank(step_data(0, \"text\"))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "\"I couldn't fetch the full story right now. Try another option in a moment.\"",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
}
],
"forwardMessageToAgent": false
},
{
"label": {
"expr": "substring(coalesce(step(0).data.articles[3].title, \"News 4\"), 0, 24)",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"value": {
"expr": "coalesce(step(0).data.articles[3].url, \"\")",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"actions": [
{
"condition": {
"expr": "present(coalesce(trigger.value, contactMessage.body.value))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/network/http/request/send",
"actions/network/http/request/send": {
"method": "GET",
"url": {
"expr": "url_params(\"https://<your-gdelt-proxy>/doc/content\", {\"url\": coalesce(trigger.value, contactMessage.body.value)})",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"headers": [],
"returnBuffer": false,
"cache": false
}
}
},
{
"condition": {
"expr": "step_ok(0) && present(step_data(0, \"text\"))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "(present(step_data(0, \"title\")) ? step_data(0, \"title\") + \"\\n\\n\" : \"\") + step_data(0, \"text\", \"\")",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
},
{
"condition": {
"expr": "!step_ok(0) || blank(step_data(0, \"text\"))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "\"I couldn't fetch the full story right now. Try another option in a moment.\"",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
}
],
"forwardMessageToAgent": false
},
{
"label": {
"expr": "substring(coalesce(step(0).data.articles[4].title, \"News 5\"), 0, 24)",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"value": {
"expr": "coalesce(step(0).data.articles[4].url, \"\")",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"actions": [
{
"condition": {
"expr": "present(coalesce(trigger.value, contactMessage.body.value))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/network/http/request/send",
"actions/network/http/request/send": {
"method": "GET",
"url": {
"expr": "url_params(\"https://<your-gdelt-proxy>/doc/content\", {\"url\": coalesce(trigger.value, contactMessage.body.value)})",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"headers": [],
"returnBuffer": false,
"cache": false
}
}
},
{
"condition": {
"expr": "step_ok(0) && present(step_data(0, \"text\"))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "(present(step_data(0, \"title\")) ? step_data(0, \"title\") + \"\\n\\n\" : \"\") + step_data(0, \"text\", \"\")",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
},
{
"condition": {
"expr": "!step_ok(0) || blank(step_data(0, \"text\"))",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/conversation/response/compose",
"actions/messaging/conversation/response/compose": {
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "\"I couldn't fetch the full story right now. Try another option in a moment.\"",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
}
],
"forwardMessageToAgent": false
}
]
}
}
]
}
}
},
{
"condition": {
"expr": "present(contact) && !(step_ok(0) && size(step_data(0, \"articles\", [])) >= 5)",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"action": {
"actionType": "actions/messaging/contact/send",
"actions/messaging/contact/send": {
"use_manual_id": true,
"contactId_manual": {
"expr": "contact",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"messages": [
{
"type": "text",
"payload": {
"text": {
"expr": "\"I couldn't load 5 climate news items right now. Please run this workflow again in a moment.\"",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
}
}
}
]
}
}
}
],
"returnExpression": {
"expr": "{\"requestedContact\": contact, \"status\": step(0).status, \"articles\": get(step(0), \"data.articles\", [])}",
"onFailure": "throw",
"fallback": "",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"customAttributes": {}
}
}