{ "kind": "open-flow-workflow", "version": 1, "name": "Upload a Public Image to Slack", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_b41b5d82ddf03b99": { "name": "Upload an image", "kind": "start", "inputDefs": [] }, "n_d6f16aecf7ea00e7": { "inputs": { "fileUrl": { "kind": "value", "value": "https://example.com/YOUR_IMAGE.png" }, "filename": { "kind": "value", "value": "sync-data-between-apps.a4be8c7.png" }, "channelId": { "kind": "value", "value": "YOUR_SLACK_CHANNEL_ID" } }, "name": "Validate image and channel", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "fileUrl" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "filename" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "channelId" } ], "outputs": [ { "jsonSchema": { "type": "string", "format": "uri", "description": "A URL whose response body should be uploaded to Slack." }, "nullable": false, "handle": "fileUrl" }, { "jsonSchema": { "type": "string", "minLength": 1, "description": "The file name Slack should display." }, "nullable": false, "handle": "filename" }, { "jsonSchema": { "type": "string", "minLength": 1, "description": "The Slack conversation or channel ID." }, "nullable": true, "handle": "channelId" } ], "name": "Validate image and channel", "moduleId": "n_0b74d84759355d21", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_b9ff9cde01b75f08": { "inputs": { "fileUrl": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_d6f16aecf7ea00e7", "output": "fileUrl" } ] }, "filename": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_d6f16aecf7ea00e7", "output": "filename" } ] }, "channelId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_d6f16aecf7ea00e7", "output": "channelId" } ] }, "initialComment": { "kind": "value", "value": "This is the file" }, "mimeType": { "kind": "value", "value": "image/png" } }, "name": "Upload the image to Slack", "kind": "task", "task": { "inputs": [ { "description": "The file name Slack should display.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The file name Slack should display." }, "nullable": false, "handle": "filename" }, { "description": "A URL whose response body should be uploaded to Slack.", "jsonSchema": { "type": "string", "format": "uri", "description": "A URL whose response body should be uploaded to Slack." }, "nullable": false, "handle": "fileUrl" }, { "description": "Optional file title shown in Slack.", "jsonSchema": { "type": "string", "description": "Optional file title shown in Slack." }, "nullable": true, "handle": "title", "value": null }, { "description": "The Slack conversation or channel ID.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The Slack conversation or channel ID." }, "nullable": true, "handle": "channelId", "value": null }, { "description": "Optional message text to post with the file.", "jsonSchema": { "type": "string", "description": "Optional message text to post with the file." }, "nullable": true, "handle": "initialComment", "value": null }, { "description": "The Slack message timestamp, for example '1711.0001'.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The Slack message timestamp, for example '1711.0001'." }, "nullable": true, "handle": "threadTs", "value": null }, { "description": "The content type to send while uploading the file.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The content type to send while uploading the file." }, "nullable": true, "handle": "mimeType", "value": null }, { "description": "Alternative text for the uploaded file when Slack supports it.", "jsonSchema": { "type": "string", "description": "Alternative text for the uploaded file when Slack supports it." }, "nullable": true, "handle": "altText", "value": null }, { "description": "Slack snippet type for text snippets.", "jsonSchema": { "type": "string", "description": "Slack snippet type for text snippets." }, "nullable": true, "handle": "snippetType", "value": null } ], "outputs": [ { "description": "The uploaded Slack file ID.", "jsonSchema": { "type": "string", "description": "The uploaded Slack file ID." }, "nullable": false, "handle": "fileId" }, { "description": "Files returned by Slack after completing the upload.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "fileId": { "type": "string", "description": "The Slack file ID." }, "name": { "type": "string", "description": "The file name." }, "title": { "type": "string", "description": "The file title." }, "mimetype": { "type": "string", "description": "The file MIME type." }, "urlPrivate": { "type": "string", "description": "The private Slack URL for the file when returned." } }, "additionalProperties": true, "description": "A Slack file object returned by the Web API." }, "description": "Files returned by Slack after completing the upload." }, "nullable": false, "handle": "files" } ], "name": "Upload the image to Slack", "executor": { "kind": "connector", "action": "slack.upload_file" } } }, "n_9c0603e99f1f523c": { "name": "Uploaded file", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "string", "description": "The uploaded Slack file ID." }, "nullable": false, "handle": "fileId" }, { "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "fileId": { "type": "string", "description": "The Slack file ID." }, "name": { "type": "string", "description": "The file name." }, "title": { "type": "string", "description": "The file title." }, "mimetype": { "type": "string", "description": "The file MIME type." }, "urlPrivate": { "type": "string", "description": "The private Slack URL for the file when returned." } }, "additionalProperties": true, "description": "A Slack file object returned by the Web API." }, "description": "Files returned by Slack after completing the upload." }, "nullable": false, "handle": "files" } ], "outputMappings": { "fileId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_b9ff9cde01b75f08", "output": "fileId" } ] }, "files": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_b9ff9cde01b75f08", "output": "files" } ] } } } }, "edges": [ { "source": "n_b41b5d82ddf03b99", "target": "n_d6f16aecf7ea00e7" }, { "source": "n_d6f16aecf7ea00e7", "target": "n_b9ff9cde01b75f08" }, { "source": "n_b9ff9cde01b75f08", "target": "n_9c0603e99f1f523c" } ] } }, "modules": { "n_0b74d84759355d21": { "name": "Validate image and channel", "imports": [], "source": "export default function configure({fileUrl,filename,channelId}){\n for(const [name,value] of Object.entries({fileUrl,filename,channelId}))if(typeof value!=='string'||!value.trim()||value.includes('YOUR_'))throw Error('Configure '+name+' before uploading');\n let url;try{url=new URL(fileUrl)}catch{throw Error('Enter a public HTTPS file URL')};if(url.protocol!=='https:'||url.username||url.password)throw Error('Enter a public HTTPS file URL');\n return{fileUrl:url.toString(),filename:filename.trim(),channelId:channelId.trim()};\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }