Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
upload

GitHub Action

Slack V2 Upload

v1.0.5

Slack V2 Upload

upload

Slack V2 Upload

Upload File to Slack

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Slack V2 Upload

uses: vaporif/[email protected]

Learn more about this action in vaporif/slack-file-upload-action

Choose a version

Slack file upload action

This action uploads file(s) to slack using v2 files API.

Inputs

token

Required Slack app token. See Internal app tokens

  1. Create app
  2. Add files:write and files:read permission
  3. Install app to your workspase
  4. Invite bot to required channels /invite <botname>
  5. Use bot token from OAuth & Permissions page

files

Required List of files including file path and filename remember json wont work with backslashes so you might need ${{ toJSON(variable) }}

channel_id

Slack channel ID for upload THIS IS NOT A CHANNEL NAME you can easily check for channel ID in the browser URL after navigating to channel there

thread_ts

Slack thread for upload

initial_comment

The message text introducing the file in specified channels.

Example usage

on: [push]

jobs:
  slack_upload_job:
    runs-on: ubuntu-latest
    name: Upload test file
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - run: |
          mkdir dir
          echo "Test file " > dir/test.txt
      - name: Upload to slack step
        uses: vaporif/slack-file-upload-action@v1
        with:
          token: ${{ secrets.SLACK_TOKEN }}
          files: >
            [
              {"file": "./dir/test.txt", "filename": "testfile.txt"},
              {"file": "./dir/test.txt", "filename": "testfile.txt"}
            ]
          channel_id: C06S5FLDSN4