FlowRunner
Features Pricing
Theme
Start Free

Indexing failures posted to Slack and logged in a sheet

When a Captain indexing job fails or finishes with errors, each failed file and its error reach your #data channel in Slack and land in a Google Sheet, so a file that keeps failing stands out.

The prompt

When one of our Captain indexing jobs fails or completes with errors, get the job's file list, post every failed file and its error to our #data channel in Slack, and add a row per failed file to our indexing log sheet with the collection, file name, error and job ID. If the whole job failed, include Captain's error code.

FlowRunner Prompt to Flow built this flow from that request. Here it is as it opens in the editor.

The flow

Repeats for each item For each failed file Action Indexing job hadproblems Code Pick out the failedfiles Action Get the job's files Action Tell #data inSlack

Inside the loop: For each failed file

Action Log the file in thesheet

Download the file, then in FlowRunner click + beside Flows, pick it under Import a Flow Version and click Create. How importing works

What each step does

  1. Indexing job had problems Starts on either Captain event: On Indexing Job Completed With Errors, or On Indexing Job Failed. Captain signs the webhook and FlowRunner checks the signature.
  2. Get the job's files Reads the job's progress and per-file results, up to 500 files.
  3. Pick out the failed files Keeps the files whose status is failed, with each one's error text. A job that failed outright with no per-file detail becomes one entry carrying Captain's error code.
  4. Tell #data in Slack Posts the collection, the job's counts of indexed, failed and skipped files, and one line per failed file with its error. The first 20 go in the message; the rest are in the sheet.
  5. Log the file in the sheet Adds one row per failed file with Collection, File, Error, Job ID, Status and When. A file that fails again gets another row, so the pattern shows.

Before you turn it on

  • Enter your Captain API key from Captain Studio, and connect your Slack and Google Sheets accounts.
  • Pick your #data channel in Tell #data in Slack.
  • Create a spreadsheet whose first tab has the columns Collection, File, Error, Job ID, Status and When, and put its URL in the flow setting Indexing log sheet.
  • Both triggers share one webhook endpoint with Captain; an organization can hold 20. Leave the Collection filter empty to hear about every collection, or pick one.