New Box files indexed in Captain, with the owner asked about replacements
Files uploaded to your Box folder are indexed into Captain with their Box file ID, folder and uploader. When an earlier version exists, the folder owner picks replace or keep both in Slack.
The prompt
When a file is uploaded to our Policies folder in Box, download it and check whether Captain already has a version of it, by the Box file ID. If not, index it into our Policies collection and tag it with the Box file ID, the folder and who uploaded it. If an earlier version is there, ask the folder owner in Slack whether to replace it or keep both, and index the file the way they choose.
FlowRunner Prompt to Flow built this flow from that request. Here it is as it opens in the editor.
The flow
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
- New file in the Box folder Starts when a file is uploaded to the Box folder you pick. Box sends the event to FlowRunner as it happens.
- Download the file Saves the file to FlowRunner file storage so Captain can fetch it.
- Look for an earlier version Lists the documents in your Captain collection whose metadata carries this Box file ID.
- Earlier version in Captain? A file Captain has not seen goes straight to Index the file. Anything with an earlier version goes to the folder owner first.
- Index the file Uploads the file into the collection with the Box file ID, folder and uploader as custom metadata. Captain indexes it in the background and returns the job ID. The flow Files announced in Slack when Captain finishes indexing them posts when it is searchable.
- Ask the folder owner The owner gets a Slack message with the file, the folder, who uploaded it, and what Captain already holds, with two buttons: Replace the earlier version and Index it beside the old one.
- Wait for the folder owner's answer The run waits for the click. Replace runs Index File with Replace Existing Document on, which keeps the document ID. Index beside it adds the new file as its own document and leaves the old one searchable.
Before you turn it on
- Connect your Box and Slack accounts, and enter your Captain API key from Captain Studio.
- Pick the Box folder to watch in New file in the Box folder, and set the flow setting Captain collection to the collection the files go into.
- Copy the URL of the block Wait for the folder owner's answer into the flow setting Answer link. The Slack buttons open it.
- Pick the folder owner's channel in Ask the folder owner.
- Replace Existing Document matches on file name, so a replacement carries the same name as the version it replaces. Box registers a webhook on the watched folder.