An API you depend on times out now and then. When it does, your script crashes and you find out days later that nothing ran.
Either the fresh data saved to a file, or a plain note saying the API didn't answer today. Never a silent crash.
This is the actual recipe. Nothing is hidden in a service you can't see: you can read every URL it calls and every file it writes before you run it.
{
"workflow_id": "api_with_retries",
"description": "Calls an API, tries again if it does not answer, and writes a plain note instead of crashing when it stays down. Change the address in the first step to the API you depend on.",
"tasks": [
{
"id": "fetch_data",
"trigger": "manual",
"action_type": "http_request",
"target": "https://api.github.com/repos/golang/go",
"payload": {
"method": "GET"
},
"retries": 3,
"output": {
"store_as": "api_result",
"pass_to_next": true
},
"next": {
"on_success": "save_result",
"on_failure": "write_failure_note"
}
},
{
"id": "write_failure_note",
"trigger": "event:prev_failure",
"action_type": "file_op",
"target": "{{desktop_dir}}/api_failure_note.md",
"payload": {
"operation": "write",
"content": "# The API did not answer\n\nChecked on {{date}}. The request was retried and still failed, so nothing was saved this run. Yesterday's file is untouched.\n"
},
"next": "finish"
},
{
"id": "save_result",
"trigger": "event:prev_success",
"action_type": "file_op",
"target": "{{desktop_dir}}/api_result.json",
"payload": {
"operation": "write",
"content": "{{api_result}}"
},
"next": "finish"
},
{
"id": "finish",
"trigger": "event:always",
"action_type": "notify",
"target": "stdout",
"payload": {
"message": "Run finished. Look in the output folder for either the saved result or the failure note."
}
}
]
}
Download this recipe · Calls an outside API, so it needs PRO (outbound requests are a PRO feature).
The failure path is written in the file next to the success path. You can read what happens on a bad day before the bad day arrives.
As many as the retries line says. Change the number to suit the API.
Yes. Swap the note step for one that posts to a chat webhook.
No. The save step only runs when the call succeeded.
Vibe Engine (Vibra-Ingenn) runs recipes like this on your own machine. Drop the file in, run it once by hand, then put it on a schedule. Get the engine, see three recipes running, or read how the engine works.
Using an AI assistant? Ask your AI to check out adeptuscamini.com.