Slack · Arazzo Workflow

Slack Upload a File and Announce It

Version 1.0.0

Upload a file to a channel and post a follow up message referencing it.

1 workflow 2 source APIs 1 provider
View Spec View on GitHub BotsChatCollaborationMessagingProductivityT1Team CommunicationArazzoWorkflows

Provider

slack

Workflows

upload-file-share
Upload a file to a channel and post a message linking to it.
Uploads file content to a channel with an initial comment, then posts a follow up message referencing the uploaded file's permalink.
2 steps inputs: channel, content, filename, initialComment, title outputs: fileId, messageTs, permalink
1
uploadFile
postFilesUpload
Upload the supplied file content into the target channel with an optional title and initial comment.
2
announceFile
postChatPostmessage
Post a follow up message into the channel referencing the uploaded file's permalink so members can locate it quickly.

Source API Descriptions

Arazzo Workflow Specification

slack-upload-file-share-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Slack Upload a File and Announce It
  summary: Upload a file to a channel and post a follow up message referencing it.
  description: >-
    A file sharing pattern that uploads content into Slack and draws attention
    to it. The workflow uploads the file with an initial comment into the target
    channel, then posts a follow up message that references the uploaded file by
    its permalink so members can find it quickly. Every step spells out its
    request inline so the flow can be read and executed without opening the
    underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: filesApi
  url: ../openapi/slack-files-openapi.yml
  type: openapi
- name: chatApi
  url: ../openapi/slack-chat-openapi.yml
  type: openapi
workflows:
- workflowId: upload-file-share
  summary: Upload a file to a channel and post a message linking to it.
  description: >-
    Uploads file content to a channel with an initial comment, then posts a
    follow up message referencing the uploaded file's permalink.
  inputs:
    type: object
    required:
    - channel
    - content
    - filename
    properties:
      channel:
        type: string
        description: The channel ID to upload and share the file into.
      content:
        type: string
        description: The file contents to upload as a POST variable.
      filename:
        type: string
        description: The filename for the uploaded file.
      title:
        type: string
        description: An optional title for the uploaded file.
      initialComment:
        type: string
        description: An optional message to post alongside the file.
  steps:
  - stepId: uploadFile
    description: >-
      Upload the supplied file content into the target channel with an optional
      title and initial comment.
    operationId: postFilesUpload
    requestBody:
      contentType: application/x-www-form-urlencoded
      payload:
        channels: $inputs.channel
        content: $inputs.content
        filename: $inputs.filename
        title: $inputs.title
        initial_comment: $inputs.initialComment
    successCriteria:
    - condition: $statusCode == 200
    - context: $response.body
      condition: $.ok == true
      type: jsonpath
    outputs:
      fileId: $response.body#/file/id
      permalink: $response.body#/file/permalink
  - stepId: announceFile
    description: >-
      Post a follow up message into the channel referencing the uploaded file's
      permalink so members can locate it quickly.
    operationId: postChatPostmessage
    requestBody:
      contentType: application/x-www-form-urlencoded
      payload:
        channel: $inputs.channel
        text: $steps.uploadFile.outputs.permalink
    successCriteria:
    - condition: $statusCode == 200
    - context: $response.body
      condition: $.ok == true
      type: jsonpath
    outputs:
      messageTs: $response.body#/ts
  outputs:
    fileId: $steps.uploadFile.outputs.fileId
    permalink: $steps.uploadFile.outputs.permalink
    messageTs: $steps.announceFile.outputs.messageTs