From 0dd314fad69dcc26d846dcd852a1b3a948d6bc37 Mon Sep 17 00:00:00 2001 From: Luke Russell Date: Tue, 14 Apr 2026 14:38:53 -0700 Subject: [PATCH 1/5] go --- docs/_sidebar.json | 91 ++------- ...ng-variables.md => gathering-variables.md} | 2 +- .../running-slack-cli-commands.md | 51 +++++- .../sending-data-slack-api-method.md | 55 +++++- .../sending-data-slack-incoming-webhook.md | 69 ++++++- docs/sending-data-webhook-slack-workflow.md | 173 ++++++++++++++++++ .../deploy-an-app.md | 13 -- .../manage-collaborators.md | 13 -- .../validate-a-manifest.md | 13 -- .../direct-message-author.md | 13 -- .../invite-usergroup-to-channel.md | 13 -- .../post-blocks-found-in-file.md | 19 -- .../post-inline-block-message.md | 13 -- .../post-inline-text-message.md | 13 -- .../format-generated-files.md | 31 ---- .../post-release-announcements.md | 31 ---- .../sending-data-webhook-slack-workflow.md | 78 -------- .../update-a-channel-topic.md | 26 --- docs/sending-techniques/sending-techniques.md | 56 ------ docs/slack-github-action.md | 9 + 20 files changed, 352 insertions(+), 430 deletions(-) rename docs/{sending-variables.md => gathering-variables.md} (97%) rename docs/{sending-techniques/running-slack-cli-commands => }/running-slack-cli-commands.md (63%) rename docs/{sending-techniques/sending-data-slack-api-method => }/sending-data-slack-api-method.md (74%) rename docs/{sending-techniques/sending-data-slack-incoming-webhook => }/sending-data-slack-incoming-webhook.md (54%) create mode 100644 docs/sending-data-webhook-slack-workflow.md delete mode 100644 docs/sending-techniques/running-slack-cli-commands/deploy-an-app.md delete mode 100644 docs/sending-techniques/running-slack-cli-commands/manage-collaborators.md delete mode 100644 docs/sending-techniques/running-slack-cli-commands/validate-a-manifest.md delete mode 100644 docs/sending-techniques/sending-data-slack-api-method/direct-message-author.md delete mode 100644 docs/sending-techniques/sending-data-slack-api-method/invite-usergroup-to-channel.md delete mode 100644 docs/sending-techniques/sending-data-slack-incoming-webhook/post-blocks-found-in-file.md delete mode 100644 docs/sending-techniques/sending-data-slack-incoming-webhook/post-inline-block-message.md delete mode 100644 docs/sending-techniques/sending-data-slack-incoming-webhook/post-inline-text-message.md delete mode 100644 docs/sending-techniques/sending-data-webhook-slack-workflow/format-generated-files.md delete mode 100644 docs/sending-techniques/sending-data-webhook-slack-workflow/post-release-announcements.md delete mode 100644 docs/sending-techniques/sending-data-webhook-slack-workflow/sending-data-webhook-slack-workflow.md delete mode 100644 docs/sending-techniques/sending-data-webhook-slack-workflow/update-a-channel-topic.md delete mode 100644 docs/sending-techniques/sending-techniques.md diff --git a/docs/_sidebar.json b/docs/_sidebar.json index 1772c310..075c833b 100644 --- a/docs/_sidebar.json +++ b/docs/_sidebar.json @@ -1,78 +1,15 @@ [ - { - "type": "doc", - "id": "tools/slack-github-action/slack-github-action", - "label": "Slack GitHub Action", - "className": "sidebar-title" - }, - { "type": "html", "value": "
" }, - "tools/slack-github-action/sending-variables", - { - "type": "category", - "label": "Sending techniques", - "collapsed": false, - "link": { - "type": "doc", - "id": "tools/slack-github-action/sending-techniques/sending-techniques" - }, - "items": [ - "tools/slack-github-action/sending-techniques/sending-techniques", - { - "type": "category", - "label": "Sending data via a webhook to start a Slack workflow", - "link": { - "type": "doc", - "id": "tools/slack-github-action/sending-techniques/sending-data-webhook-slack-workflow/sending-data-webhook-slack-workflow" - }, - "items": [ - "tools/slack-github-action/sending-techniques/sending-data-webhook-slack-workflow/sending-data-webhook-slack-workflow", - "tools/slack-github-action/sending-techniques/sending-data-webhook-slack-workflow/format-generated-files", - "tools/slack-github-action/sending-techniques/sending-data-webhook-slack-workflow/post-release-announcements", - "tools/slack-github-action/sending-techniques/sending-data-webhook-slack-workflow/update-a-channel-topic" - ] - }, - { - "type": "category", - "label": "Sending data using a Slack API method", - "link": { - "type": "doc", - "id": "tools/slack-github-action/sending-techniques/sending-data-slack-api-method/sending-data-slack-api-method" - }, - "items": [ - "tools/slack-github-action/sending-techniques/sending-data-slack-api-method/sending-data-slack-api-method", - "tools/slack-github-action/sending-techniques/sending-data-slack-api-method/direct-message-author", - "tools/slack-github-action/sending-techniques/sending-data-slack-api-method/invite-usergroup-to-channel" - ] - }, - { - "type": "category", - "label": "Sending data as a message with a Slack incoming webhook URL", - "link": { - "type": "doc", - "id": "tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/sending-data-slack-incoming-webhook" - }, - "items": [ - "tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/sending-data-slack-incoming-webhook", - "tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/post-inline-text-message", - "tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/post-inline-block-message", - "tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/post-blocks-found-in-file" - ] - }, - { - "type": "category", - "label": "Running Slack CLI commands", - "link": { - "type": "doc", - "id": "tools/slack-github-action/sending-techniques/running-slack-cli-commands/running-slack-cli-commands" - }, - "items": [ - "tools/slack-github-action/sending-techniques/running-slack-cli-commands/running-slack-cli-commands", - "tools/slack-github-action/sending-techniques/running-slack-cli-commands/deploy-an-app", - "tools/slack-github-action/sending-techniques/running-slack-cli-commands/validate-a-manifest", - "tools/slack-github-action/sending-techniques/running-slack-cli-commands/manage-collaborators" - ] - } - ] - }, - "tools/slack-github-action/additional-configurations" - ] \ No newline at end of file + { + "type": "doc", + "id": "tools/slack-github-action/slack-github-action", + "label": "Slack GitHub Action", + "className": "sidebar-title" + }, + { "type": "html", "value": "
" }, + "/tools/slack-github-action/sending-variables", + "tools/slack-github-action/sending-data-webhook-slack-workflow/sending-data-webhook-slack-workflow", + "tools/slack-github-action/sending-data-slack-api-method/sending-data-slack-api-method", + "tools/slack-github-action/sending-data-slack-incoming-webhook/sending-data-slack-incoming-webhook", + "tools/slack-github-action/running-slack-cli-commands/running-slack-cli-commands", + "tools/slack-github-action/additional-configurations" +] diff --git a/docs/sending-variables.md b/docs/gathering-variables.md similarity index 97% rename from docs/sending-variables.md rename to docs/gathering-variables.md index 1db87955..8683059c 100644 --- a/docs/sending-variables.md +++ b/docs/gathering-variables.md @@ -1,4 +1,4 @@ -# Sending variables +# Gathering variables There are different [techniques to send data](/tools/slack-github-action/sending-techniques) into Slack and whichever one is chosen will require a certain set of customized inputs, as described later. diff --git a/docs/sending-techniques/running-slack-cli-commands/running-slack-cli-commands.md b/docs/running-slack-cli-commands.md similarity index 63% rename from docs/sending-techniques/running-slack-cli-commands/running-slack-cli-commands.md rename to docs/running-slack-cli-commands.md index dc599179..5de51b8d 100644 --- a/docs/sending-techniques/running-slack-cli-commands/running-slack-cli-commands.md +++ b/docs/running-slack-cli-commands.md @@ -1,7 +1,3 @@ ---- -sidebar_label: Overview ---- - # Running Slack CLI commands The Slack CLI technique installs and runs [Slack CLI](/tools/slack-cli/) commands directly from a GitHub Actions workflow. @@ -95,6 +91,47 @@ steps: ## Example workflows -* [**Deploy an app**](/tools/slack-github-action/sending-techniques/running-slack-cli-commands/deploy-an-app): Deploy to Slack on push to the main branch. -* [**Validate a manifest**](/tools/slack-github-action/sending-techniques/running-slack-cli-commands/validate-a-manifest): Check the app manifest on pull requests. -* [**Manage collaborators**](/tools/slack-github-action/sending-techniques/running-slack-cli-commands/manage-collaborators): Add or remove an app collaborator using CLI and API techniques together. +
+Deploy an app + +This workflow deploys a Slack app when changes are pushed to the main branch. + +This example uses a service token to authenticate the deploy command. + +### GitHub Actions workflow + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_4_Slack_CLI_Command/deploy.yml +``` + +
+ +
+Validate a manifest + +This workflow validates the app manifest on pull requests to catch configuration issues early. + +This example checks the app manifest file in the repository. + +### GitHub Actions workflow + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_4_Slack_CLI_Command/manifest.yml +``` + +
+ +
+Manage collaborators + +This workflow adds or removes an app collaborator using a manually triggered workflow. + +This example combines the Slack API technique ([`users.lookupByEmail`](https://docs.slack.dev/reference/methods/users.lookupByEmail), [`chat.postMessage`](https://docs.slack.dev/reference/methods/chat.postMessage)) with the CLI technique ([`collaborators add`](https://docs.slack.dev/tools/slack-cli/reference/commands/slack_collaborators_add)/[`remove`](https://docs.slack.dev/tools/slack-cli/reference/commands/slack_collaborators_remove)) to look up a user by email, update collaborators, and post a confirmation message. + +### GitHub Actions workflow + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_4_Slack_CLI_Command/collaborators.yml +``` + +
diff --git a/docs/sending-techniques/sending-data-slack-api-method/sending-data-slack-api-method.md b/docs/sending-data-slack-api-method.md similarity index 74% rename from docs/sending-techniques/sending-data-slack-api-method/sending-data-slack-api-method.md rename to docs/sending-data-slack-api-method.md index b1466e19..b27f5bce 100644 --- a/docs/sending-techniques/sending-data-slack-api-method/sending-data-slack-api-method.md +++ b/docs/sending-data-slack-api-method.md @@ -1,7 +1,3 @@ ---- -sidebar_label: Overview ---- - # Sending data using a Slack API method A bot token or user token or [token of some other kind](/authentication/tokens) must be used to call one of [the Slack API methods](/reference/methods) with this technique. @@ -139,7 +135,54 @@ Calling [a Slack API method](/reference/methods) with [`@slack/web-api`](/tools/ filename: "results-${{ github.sha }}.out" ``` +## Expected outputs + +The technique, like all Slack Github Action techniques, [outputs values](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/passing-information-between-jobs) that can be used as inputs in following steps of a GitHub workflow. + +The following outputs are returned with each of the techniques: + +| Output | Type | Description| +|---|---|---| +|`time` | `number` | The Unix [epoch time](https://en.wikipedia.org/wiki/Unix_time) that the step completed. +| `ok` | `boolean` | If the request completed with success. +| `response` | `string` | The [response](/apis/web-api/#responses) from the request as stringified JSON. + +While these outputs are returned with certain Slack API methods: + +| Output | Type | Description| +|---|---|---| +|`channel_id` | `string` | The [channel ID](/reference/objects/conversation-object) included in the response. +| `ts`| `string` | The [timestamp](/messaging/retrieving-messages#individual_messages) of the Slack event or message. +| `thread_ts` | `string` | The [timestamp](/messaging/retrieving-messages#individual_messages) of a parent Slack message with [threaded replies](/messaging/retrieving-messages#pulling_threads). + ## Example workflows -- [**Direct message the author**](/tools/slack-github-action/sending-techniques/sending-data-slack-api-method/direct-message-author): Write to the Slack user with a matching email. -- [**Invite a usergroup to channel**](/tools/slack-github-action/sending-techniques/sending-data-slack-api-method/invite-usergroup-to-channel): Create a channel and invite members. +
+Direct message the author + +This workflow sends a direct message to the user that pushed the most recent commits. + +This example uses the email of the pusher to find the user to send a message to. + +### GitHub Actions workflow + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_2_Slack_API_Method/author.yml +``` + +
+ +
+Invite a usergroup to channel + +This workflow creates a channel after a bug is reported and add members of a usergroup. + +This example chains multiple Slack API methods together to help fix bugs fast. + +### GitHub Actions workflow + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_2_Slack_API_Method/invite.yml +``` + +
diff --git a/docs/sending-techniques/sending-data-slack-incoming-webhook/sending-data-slack-incoming-webhook.md b/docs/sending-data-slack-incoming-webhook.md similarity index 54% rename from docs/sending-techniques/sending-data-slack-incoming-webhook/sending-data-slack-incoming-webhook.md rename to docs/sending-data-slack-incoming-webhook.md index 0d7be4d0..be357b7f 100644 --- a/docs/sending-techniques/sending-data-slack-incoming-webhook/sending-data-slack-incoming-webhook.md +++ b/docs/sending-data-slack-incoming-webhook.md @@ -1,7 +1,3 @@ ---- -sidebar_label: Overview ---- - # Sending data as a message with a Slack incoming webhook URL This technique uses this Action to post a message to a channel or direct message with [incoming webhooks](/messaging/sending-messages-using-incoming-webhooks) and a Slack app. @@ -44,8 +40,67 @@ Add the collected webhook from above to a GitHub workflow and configure the step text: "GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" ``` +## Expected outputs + +The technique, like all Slack Github Action techniques, [outputs values](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/passing-information-between-jobs) that can be used as inputs in following steps of a GitHub workflow. + +The following outputs are returned with each of the techniques: + +| Output | Type | Description| +|---|---|---| +|`time` | `number` | The Unix [epoch time](https://en.wikipedia.org/wiki/Unix_time) that the step completed. +| `ok` | `boolean` | If the request completed with success. +| `response` | `string` | The [response](/apis/web-api/#responses) from the request as stringified JSON. + ## Example workflows -* [**Post an inline text message**](/tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/post-inline-text-message) -* [**Post an inline block message**](/tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/post-inline-block-message) -* [**Post blocks found in a file**](/tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/post-blocks-found-in-file) \ No newline at end of file +
+Post an inline text message + +This workflow writes a line of text after a push event is received. + +This example uses incoming webhooks to post a plain text message. + +### GitHub Actions workflow + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_3_Slack_Incoming_Webhook/text.yml +``` + +
+ +
+Post an inline block message + +This workflow formats a response to recent adventures. + +This example uses incoming webhooks to post a message with Block Kit. + +### GitHub Actions workflow + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_3_Slack_Incoming_Webhook/blocks.yml +``` + +
+ +
+Post blocks found in a file + +This workflow links to the GitHub Actions job in progress. + +This example uses file data when posting to an incoming webhook. + +### Payload file being sent + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_3_Slack_Incoming_Webhook/saved.data.json +``` + +### GitHub Actions workflow + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_3_Slack_Incoming_Webhook/saved.gha.yml +``` + +
\ No newline at end of file diff --git a/docs/sending-data-webhook-slack-workflow.md b/docs/sending-data-webhook-slack-workflow.md new file mode 100644 index 00000000..32b9f16e --- /dev/null +++ b/docs/sending-data-webhook-slack-workflow.md @@ -0,0 +1,173 @@ +# Sending data via a webhook to start a Slack workflow + +:::info[This technique requires [a Slack paid plan](https://slack.com/pricing) to use Workflow Builder.] +::: + +This technique sends data to Slack using a webhook to start a workflow created using Slack [Workflow Builder](https://slack.com/features/workflow-automation). + +## Setup + +Start in Slack to create a Slack workflow: + +1. [Create a Slack workflow](https://slack.com/help/articles/360041352714-Build-a-workflow--Create-a-workflow-that-starts-outside-of-Slack) that starts from a webhook. +2. Copy the webhook URL and [add it as a repository secret](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository) called `SLACK_WEBHOOK_URL`. +3. [Add this Action as a step](https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idsteps) to your GitHub workflow and provide an input payload to send to the webhook. +4. Configure your Slack workflow to use the payload variables sent from the GitHub Action. You can then update the steps of the Slack workflow to use these values in creative and clever ways. + +The webhook URL will resemble something like so: + +```txt +https://hooks.slack.com/triggers/T0123456789/3141592653589/c6e6c0d868b3054ca0f4611a5dbadaf +``` + +## Usage + +Update the input payloads sent from this GitHub Action to your Slack workflow using the following options: + +### Sending values from the default GitHub event context + +In the example below, the default GitHub event [context](https://github.com/actions/toolkit/blob/main/packages/github/src/context.ts#L6) and event [payload](https://docs.github.com/en/webhooks/webhook-events-and-payloads) associated with the job that started the GitHub workflow are sent to the provided webhook URL: + +```yaml +- name: Send GitHub Action data to a Slack workflow + uses: slackapi/slack-github-action@v3.0.1 + with: + payload-delimiter: "_" + webhook: ${{ secrets.SLACK_WEBHOOK_URL }} + webhook-type: webhook-trigger +``` + +Accessing variables sent to [Workflow Builder](https://slack.com/features/workflow-automation) with a webhook require that the payload variables are flattened with stringified values. Nested variables in the provided payload can be both flattened and also stringified with the `payload-delimiter` option or changed with other [configurations](/tools/slack-github-action/additional-configurations) to match this format expected from Workflow Builder. + +### Providing parsed payload information as strings + +Provided input values for payload information are sent to the webhook URL after the job is started: + +```yaml +- name: Send custom event details to a Slack workflow + uses: slackapi/slack-github-action@v3.0.1 + with: + webhook: ${{ secrets.SLACK_WEBHOOK_URL }} + webhook-type: webhook-trigger + payload: | + status: "${{ job.status }}" + option: "false" +``` + +### Gathering details of the payload from a saved file + +Input values for the payload to be sent can also be provided in a file, either in JSON or YAML format: + +```yaml +- name: Send a saved artifact to a Slack workflow + uses: slackapi/slack-github-action@v3.0.1 + with: + payload-file-path: "./artifacts.json" + webhook: ${{ secrets.SLACK_WEBHOOK_URL }} + webhook-type: webhook-trigger +``` + +## Expected outputs + +The technique, like all Slack Github Action techniques, [outputs values](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/passing-information-between-jobs) that can be used as inputs in following steps of a GitHub workflow. + +The following outputs are returned with each of the techniques: + +| Output | Type | Description| +|---|---|---| +|`time` | `number` | The Unix [epoch time](https://en.wikipedia.org/wiki/Unix_time) that the step completed. +| `ok` | `boolean` | If the request completed with success. +| `response` | `string` | The [response](/apis/web-api/#responses) from the request as stringified JSON. + +## Example workflows + +
+Format generated files + +This workflow converts build outputs from earlier GitHub Action steps into a Slack message. + +This example uses data from a payload file to [send a message](/tools/deno-slack-sdk/reference/slack-functions/send_message/) to a hardcoded channel. + +### Payload file being sent + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/builds.data.json +``` + +### GitHub Actions workflow + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/builds.gha.yml +``` + +### Slack app manifest + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/builds.manifest.json +``` + +### Slack webhook trigger + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/builds.trigger.json +``` + +
+ +
+Post release announcements + +This workflow allows you to select a channel to post news about the most recent release to. + +This example uses [Slack functions](/tools/deno-slack-sdk/guides/creating-slack-functions/) and inline inputs to do the following: + +1. Open a form to select a channel. +2. Send a message to the selected channel. +3. React with a `:tada:` emoji. + +### GitHub Actions workflow + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/announcements.gha.yml +``` + +### Slack app manifest + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/announcements.manifest.json +``` + +### Slack webhook trigger + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/announcements.trigger.json +``` + +
+ +
+Update a channel topic + +This workflow shows the latest commit status in the header of a channel. + +This example uses the default GitHub event [context](https://github.com/actions/toolkit/blob/main/packages/github/src/context.ts#L6) and [payload](https://docs.github.com/en/webhooks/webhook-events-and-payloads) to [update a channel topic](/tools/deno-slack-sdk/reference/slack-functions/update_channel_topic/). + +### GitHub Actions workflow + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/topic.gha.yml +``` + +### Slack app manifest + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/topic.manifest.json +``` + +### Slack webhook trigger + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/topic.trigger.json +``` + +
\ No newline at end of file diff --git a/docs/sending-techniques/running-slack-cli-commands/deploy-an-app.md b/docs/sending-techniques/running-slack-cli-commands/deploy-an-app.md deleted file mode 100644 index fc225d72..00000000 --- a/docs/sending-techniques/running-slack-cli-commands/deploy-an-app.md +++ /dev/null @@ -1,13 +0,0 @@ -# Example workflow: deploy an app - -This workflow deploys a Slack app when changes are pushed to the main branch. - -This example uses a service token to authenticate the deploy command. - -## Files - -### GitHub Actions workflow - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_4_Slack_CLI_Command/deploy.yml -``` diff --git a/docs/sending-techniques/running-slack-cli-commands/manage-collaborators.md b/docs/sending-techniques/running-slack-cli-commands/manage-collaborators.md deleted file mode 100644 index d2f9fe88..00000000 --- a/docs/sending-techniques/running-slack-cli-commands/manage-collaborators.md +++ /dev/null @@ -1,13 +0,0 @@ -# Example workflow: manage collaborators - -This workflow adds or removes an app collaborator using a manually triggered workflow. - -This example combines the Slack API technique ([`users.lookupByEmail`](https://docs.slack.dev/reference/methods/users.lookupByEmail), [`chat.postMessage`](https://docs.slack.dev/reference/methods/chat.postMessage)) with the CLI technique ([`collaborators add`](https://docs.slack.dev/tools/slack-cli/reference/commands/slack_collaborators_add)/[`remove`](https://docs.slack.dev/tools/slack-cli/reference/commands/slack_collaborators_remove)) to look up a user by email, update collaborators, and post a confirmation message. - -## Files - -### GitHub Actions workflow - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_4_Slack_CLI_Command/collaborators.yml -``` diff --git a/docs/sending-techniques/running-slack-cli-commands/validate-a-manifest.md b/docs/sending-techniques/running-slack-cli-commands/validate-a-manifest.md deleted file mode 100644 index bf69b53e..00000000 --- a/docs/sending-techniques/running-slack-cli-commands/validate-a-manifest.md +++ /dev/null @@ -1,13 +0,0 @@ -# Example workflow: validate a manifest - -This workflow validates the app manifest on pull requests to catch configuration issues early. - -This example checks the app manifest file in the repository. - -## Files - -### GitHub Actions workflow - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_4_Slack_CLI_Command/manifest.yml -``` diff --git a/docs/sending-techniques/sending-data-slack-api-method/direct-message-author.md b/docs/sending-techniques/sending-data-slack-api-method/direct-message-author.md deleted file mode 100644 index 92f2d2fc..00000000 --- a/docs/sending-techniques/sending-data-slack-api-method/direct-message-author.md +++ /dev/null @@ -1,13 +0,0 @@ -# Example workflow: direct message the author - -This workflow sends a direct message to the user that pushed the most recent commits. - -This example uses the email of the pusher to find the user to send a message to. - -## Files - -### GitHub Actions workflow - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_2_Slack_API_Method/author.yml -``` \ No newline at end of file diff --git a/docs/sending-techniques/sending-data-slack-api-method/invite-usergroup-to-channel.md b/docs/sending-techniques/sending-data-slack-api-method/invite-usergroup-to-channel.md deleted file mode 100644 index a5d183ed..00000000 --- a/docs/sending-techniques/sending-data-slack-api-method/invite-usergroup-to-channel.md +++ /dev/null @@ -1,13 +0,0 @@ -# Example workflow: invite a usergroup to channel - -This workflow creates a channel after a bug is reported and add members of a usergroup. - -This example chains multiple Slack API methods together to help fix bugs fast. - -## Files - -### GitHub Actions workflow - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_2_Slack_API_Method/invite.yml -``` \ No newline at end of file diff --git a/docs/sending-techniques/sending-data-slack-incoming-webhook/post-blocks-found-in-file.md b/docs/sending-techniques/sending-data-slack-incoming-webhook/post-blocks-found-in-file.md deleted file mode 100644 index 516c2805..00000000 --- a/docs/sending-techniques/sending-data-slack-incoming-webhook/post-blocks-found-in-file.md +++ /dev/null @@ -1,19 +0,0 @@ -# Example workflow: post blocks found in a file - -This workflow links to the GitHub Actions job in progress. - -This example uses file data when posting to an incoming webhook. - -## Files - -### Payload file being sent - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_3_Slack_Incoming_Webhook/saved.data.json -``` - -### GitHub Actions workflow - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_3_Slack_Incoming_Webhook/saved.gha.yml -``` \ No newline at end of file diff --git a/docs/sending-techniques/sending-data-slack-incoming-webhook/post-inline-block-message.md b/docs/sending-techniques/sending-data-slack-incoming-webhook/post-inline-block-message.md deleted file mode 100644 index fbc05a07..00000000 --- a/docs/sending-techniques/sending-data-slack-incoming-webhook/post-inline-block-message.md +++ /dev/null @@ -1,13 +0,0 @@ -# Example workflow: post an inline block message - -This workflow formats a response to recent adventures. - -This example uses incoming webhooks to post a message with Block Kit. - -## Files - -### GitHub Actions workflow - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_3_Slack_Incoming_Webhook/blocks.yml -``` \ No newline at end of file diff --git a/docs/sending-techniques/sending-data-slack-incoming-webhook/post-inline-text-message.md b/docs/sending-techniques/sending-data-slack-incoming-webhook/post-inline-text-message.md deleted file mode 100644 index e19ac6aa..00000000 --- a/docs/sending-techniques/sending-data-slack-incoming-webhook/post-inline-text-message.md +++ /dev/null @@ -1,13 +0,0 @@ -# Example workflow: post an inline text message - -This workflow writes a line of text after a push event is received. - -This example uses incoming webhooks to post a plain text message. - -## Files - -### GitHub Actions workflow - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_3_Slack_Incoming_Webhook/text.yml -``` \ No newline at end of file diff --git a/docs/sending-techniques/sending-data-webhook-slack-workflow/format-generated-files.md b/docs/sending-techniques/sending-data-webhook-slack-workflow/format-generated-files.md deleted file mode 100644 index e3dbf62c..00000000 --- a/docs/sending-techniques/sending-data-webhook-slack-workflow/format-generated-files.md +++ /dev/null @@ -1,31 +0,0 @@ -# Example workflow: format generated files - -This workflow converts build outputs from earlier GitHub Action steps into a Slack message. - -This example uses data from a payload file to [send a message](/tools/deno-slack-sdk/reference/slack-functions/send_message/) to a hardcoded channel. - -## Files - -### Payload file being sent - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/builds.data.json -``` - -### GitHub Actions workflow - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/builds.gha.yml -``` - -### Slack app manifest - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/builds.manifest.json -``` - -### Slack webhook trigger - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/builds.trigger.json -``` diff --git a/docs/sending-techniques/sending-data-webhook-slack-workflow/post-release-announcements.md b/docs/sending-techniques/sending-data-webhook-slack-workflow/post-release-announcements.md deleted file mode 100644 index ddfec23b..00000000 --- a/docs/sending-techniques/sending-data-webhook-slack-workflow/post-release-announcements.md +++ /dev/null @@ -1,31 +0,0 @@ -# Example workflow: post release announcements - -This workflow allows you to select a channel to post news about the most recent release to. - -This example uses [Slack functions](/tools/deno-slack-sdk/guides/creating-slack-functions/) and inline inputs to do the -following: - -1. Open a form to select a channel. -2. Send a message to the selected channel. -3. React with a `:tada:` emoji. - -## Files - -### GitHub Actions workflow - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/announcements.gha.yml -``` - -#### Slack app manifest - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/announcements.manifest.json -``` - -### Slack webhook trigger - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/announcements.trigger.json -``` - diff --git a/docs/sending-techniques/sending-data-webhook-slack-workflow/sending-data-webhook-slack-workflow.md b/docs/sending-techniques/sending-data-webhook-slack-workflow/sending-data-webhook-slack-workflow.md deleted file mode 100644 index 4cb4c6b6..00000000 --- a/docs/sending-techniques/sending-data-webhook-slack-workflow/sending-data-webhook-slack-workflow.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -sidebar_label: Overview ---- - -# Sending data via a webhook to start a Slack workflow - -:::info[This technique requires [a Slack paid plan](https://slack.com/pricing) to use Workflow Builder.] -::: - -This technique sends data to Slack using a webhook to start a workflow created using Slack [Workflow Builder](https://slack.com/features/workflow-automation). - -## Setup - -Start in Slack to create a Slack workflow: - -1. [Create a Slack workflow](https://slack.com/help/articles/360041352714-Build-a-workflow--Create-a-workflow-that-starts-outside-of-Slack) that starts from a webhook. -2. Copy the webhook URL and [add it as a repository secret](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository) called `SLACK_WEBHOOK_URL`. -3. [Add this Action as a step](https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idsteps) to your GitHub workflow and provide an input payload to send to the webhook. -4. Configure your Slack workflow to use the payload variables sent from the GitHub Action. You can then update the steps of the Slack workflow to use these values in creative and clever ways. - -The webhook URL will resemble something like so: - -```txt -https://hooks.slack.com/triggers/T0123456789/3141592653589/c6e6c0d868b3054ca0f4611a5dbadaf -``` - -## Usage - -Update the input payloads sent from this GitHub Action to your Slack workflow using the following options: - -### Sending values from the default GitHub event context - -In the example below, the default GitHub event [context](https://github.com/actions/toolkit/blob/main/packages/github/src/context.ts#L6) and event [payload](https://docs.github.com/en/webhooks/webhook-events-and-payloads) associated with the job that started the GitHub workflow are sent to the provided webhook URL: - -```yaml -- name: Send GitHub Action data to a Slack workflow - uses: slackapi/slack-github-action@v3.0.1 - with: - payload-delimiter: "_" - webhook: ${{ secrets.SLACK_WEBHOOK_URL }} - webhook-type: webhook-trigger -``` - -Accessing variables sent to [Workflow Builder](https://slack.com/features/workflow-automation) with a webhook require that the payload variables are flattened with stringified values. Nested variables in the provided payload can be both flattened and also stringified with the `payload-delimiter` option or changed with other [configurations](/tools/slack-github-action/additional-configurations) to match this format expected from Workflow Builder. - -### Providing parsed payload information as strings - -Provided input values for payload information are sent to the webhook URL after the job is started: - -```yaml -- name: Send custom event details to a Slack workflow - uses: slackapi/slack-github-action@v3.0.1 - with: - webhook: ${{ secrets.SLACK_WEBHOOK_URL }} - webhook-type: webhook-trigger - payload: | - status: "${{ job.status }}" - option: "false" -``` - -### Gathering details of the payload from a saved file - -Input values for the payload to be sent can also be provided in a file, either in JSON or YAML format: - -```yaml -- name: Send a saved artifact to a Slack workflow - uses: slackapi/slack-github-action@v3.0.1 - with: - payload-file-path: "./artifacts.json" - webhook: ${{ secrets.SLACK_WEBHOOK_URL }} - webhook-type: webhook-trigger -``` - -## Example workflows - -* [**Format generated files**](/tools/slack-github-action/sending-techniques/sending-data-webhook-slack-workflow/format-generated-files): Message outputs from prior steps. -* [**Post release announcements**](/tools/slack-github-action/sending-techniques/sending-data-webhook-slack-workflow/post-release-announcements): Share releases to a channel. -* [**Update a channel topic**](/tools/slack-github-action/sending-techniques/sending-data-webhook-slack-workflow/update-a-channel-topic): Highlight the current build status. \ No newline at end of file diff --git a/docs/sending-techniques/sending-data-webhook-slack-workflow/update-a-channel-topic.md b/docs/sending-techniques/sending-data-webhook-slack-workflow/update-a-channel-topic.md deleted file mode 100644 index 699a6634..00000000 --- a/docs/sending-techniques/sending-data-webhook-slack-workflow/update-a-channel-topic.md +++ /dev/null @@ -1,26 +0,0 @@ -# Example workflow: update a channel topic - -This workflow shows the latest commit status in the header of a channel. - -This example uses the default GitHub event [context](https://github.com/actions/toolkit/blob/main/packages/github/src/context.ts#L6) and [payload](https://docs.github.com/en/webhooks/webhook-events-and-payloads) to [update a channel topic](/tools/deno-slack-sdk/reference/slack-functions/update_channel_topic/). - -## Related files - -### GitHub Actions workflow - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/topic.gha.yml -``` - -### Slack app manifest - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/topic.manifest.json -``` - -### Slack webhook trigger - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/topic.trigger.json -``` - diff --git a/docs/sending-techniques/sending-techniques.md b/docs/sending-techniques/sending-techniques.md deleted file mode 100644 index ec2601fd..00000000 --- a/docs/sending-techniques/sending-techniques.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -sidebar_label: Overview ---- - -# Sending techniques - -This GitHub Action offers four different techniques to interact with Slack: - -* [Send data with a webhook to start a workflow in Workflow Builder](/tools/slack-github-action/sending-techniques/sending-data-webhook-slack-workflow). -* [Send data using a Slack API method and a secret token with required scopes](/tools/slack-github-action/sending-techniques/sending-data-slack-api-method/). -* [Send data as a message with a Slack incoming webhook URL](/tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/). -* [Run Slack CLI commands with a service token](/tools/slack-github-action/sending-techniques/running-slack-cli-commands/running-slack-cli-commands). - -## Expected outputs - -Each technique above [outputs values](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/passing-information-between-jobs) that can be used as inputs in following steps of a GitHub workflow. - -The following outputs are returned with each of the techniques: - -| Output | Type | Description| -|---|---|---| -|`time` | `number` | The Unix [epoch time](https://en.wikipedia.org/wiki/Unix_time) that the step completed. -| `ok` | `boolean` | If the request completed with success. -| `response` | `string` | The [response](/apis/web-api/#responses) from the request as stringified JSON. - -While these outputs are returned with certain Slack API methods: - -| Output | Type | Description| -|---|---|---| -|`channel_id` | `string` | The [channel ID](/reference/objects/conversation-object) included in the response. -| `ts`| `string` | The [timestamp](/messaging/retrieving-messages#individual_messages) of the Slack event or message. -| `thread_ts` | `string` | The [timestamp](/messaging/retrieving-messages#individual_messages) of a parent Slack message with [threaded replies](/messaging/retrieving-messages#pulling_threads). - -## Example responses - -The following snippet shows how multiple steps can be chained together to create a Slack channel before posting a message: - -```yaml -- name: Create a new Slack channel for recent changes - id: conversation - uses: slackapi/slack-github-action@v3.0.1 - with: - method: conversations.create - token: ${{ secrets.SLACK_BOT_TOKEN }} - payload: | - name: pull-request-review-${{ github.sha }} -- name: Send the pull request link into the Slack channel - if: ${{ steps.conversation.outputs.ok }} - uses: slackapi/slack-github-action@v3.0.1 - with: - method: chat.postMessage - token: ${{ secrets.SLACK_BOT_TOKEN }} - payload: | - channel: ${{ steps.conversation.outputs.channel_id }} - text: "A PR was created : ${{ github.event.pull_request.html_url }}" -``` diff --git a/docs/slack-github-action.md b/docs/slack-github-action.md index 10c2721d..83c050d4 100644 --- a/docs/slack-github-action.md +++ b/docs/slack-github-action.md @@ -2,6 +2,15 @@ The Slack GitHub Action is for sending data to Slack and running commands. +The Slack GitHub Action offers four different techniques for sending data to and interacting with Slack: + +* [Send data with a webhook to start a workflow in Workflow Builder](/tools/slack-github-action/sending-data-webhook-slack-workflow). +* [Send data using a Slack API method and a secret token with required scopes](/tools/slack-github-action/sending-data-slack-api-method/). +* [Send data as a message with a Slack incoming webhook URL](/tools/slack-github-action/sending-data-slack-incoming-webhook/). +* [Run Slack CLI commands](/tools/slack-github-action/running-slack-cli-commands/running-slack-cli-commands). + +--- + ## Versioning We recommend using the latest version of this GitHub Action for the most recent updates and fixes. From 751557f7ed07d6394e602e8f246988830f5ee605 Mon Sep 17 00:00:00 2001 From: Luke Russell Date: Tue, 14 Apr 2026 14:46:09 -0700 Subject: [PATCH 2/5] go --- docs/_sidebar.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/_sidebar.json b/docs/_sidebar.json index 075c833b..dcc6caec 100644 --- a/docs/_sidebar.json +++ b/docs/_sidebar.json @@ -6,10 +6,10 @@ "className": "sidebar-title" }, { "type": "html", "value": "
" }, - "/tools/slack-github-action/sending-variables", - "tools/slack-github-action/sending-data-webhook-slack-workflow/sending-data-webhook-slack-workflow", - "tools/slack-github-action/sending-data-slack-api-method/sending-data-slack-api-method", - "tools/slack-github-action/sending-data-slack-incoming-webhook/sending-data-slack-incoming-webhook", - "tools/slack-github-action/running-slack-cli-commands/running-slack-cli-commands", + "/tools/slack-github-action/gathering-variables", + "tools/slack-github-action/sending-data-webhook-slack-workflow", + "tools/slack-github-action/sending-data-slack-api-method", + "tools/slack-github-action/sending-data-slack-incoming-webhook", + "tools/slack-github-action/running-slack-cli-commands", "tools/slack-github-action/additional-configurations" ] From 76fecc59f73b84b25f21c0dfd362222fbd8438fd Mon Sep 17 00:00:00 2001 From: Luke Russell Date: Tue, 14 Apr 2026 14:53:17 -0700 Subject: [PATCH 3/5] sdfsdfsf --- docs/_sidebar.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_sidebar.json b/docs/_sidebar.json index dcc6caec..eb712770 100644 --- a/docs/_sidebar.json +++ b/docs/_sidebar.json @@ -6,7 +6,7 @@ "className": "sidebar-title" }, { "type": "html", "value": "
" }, - "/tools/slack-github-action/gathering-variables", + "tools/slack-github-action/gathering-variables", "tools/slack-github-action/sending-data-webhook-slack-workflow", "tools/slack-github-action/sending-data-slack-api-method", "tools/slack-github-action/sending-data-slack-incoming-webhook", From 334e17ff8e631d4f4918120470655a1aba744ee2 Mon Sep 17 00:00:00 2001 From: Luke Russell Date: Tue, 14 Apr 2026 15:06:15 -0700 Subject: [PATCH 4/5] go --- docs/gathering-variables.md | 2 +- docs/running-slack-cli-commands.md | 12 +----------- docs/sending-data-slack-api-method.md | 11 ++--------- docs/sending-data-slack-incoming-webhook.md | 20 +++++--------------- docs/sending-data-webhook-slack-workflow.md | 20 ++++++++++---------- docs/slack-github-action.md | 2 +- 6 files changed, 20 insertions(+), 47 deletions(-) diff --git a/docs/gathering-variables.md b/docs/gathering-variables.md index 8683059c..c4df36ef 100644 --- a/docs/gathering-variables.md +++ b/docs/gathering-variables.md @@ -1,6 +1,6 @@ # Gathering variables -There are different [techniques to send data](/tools/slack-github-action/sending-techniques) into Slack and whichever one is chosen will require a certain set of customized inputs, as described later. +There are different techniques to send data into Slack and whichever one is chosen will require a certain set of customized inputs, as described later. You can provide data to send to Slack from this GitHub Action and either source: diff --git a/docs/running-slack-cli-commands.md b/docs/running-slack-cli-commands.md index 5de51b8d..de41bc8a 100644 --- a/docs/running-slack-cli-commands.md +++ b/docs/running-slack-cli-commands.md @@ -94,11 +94,7 @@ steps:
Deploy an app -This workflow deploys a Slack app when changes are pushed to the main branch. - -This example uses a service token to authenticate the deploy command. - -### GitHub Actions workflow +This workflow deploys a Slack app when changes are pushed to the main branch. It uses a service token to authenticate the deploy command. ```js reference https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_4_Slack_CLI_Command/deploy.yml @@ -111,10 +107,6 @@ https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Tech This workflow validates the app manifest on pull requests to catch configuration issues early. -This example checks the app manifest file in the repository. - -### GitHub Actions workflow - ```js reference https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_4_Slack_CLI_Command/manifest.yml ``` @@ -128,8 +120,6 @@ This workflow adds or removes an app collaborator using a manually triggered wor This example combines the Slack API technique ([`users.lookupByEmail`](https://docs.slack.dev/reference/methods/users.lookupByEmail), [`chat.postMessage`](https://docs.slack.dev/reference/methods/chat.postMessage)) with the CLI technique ([`collaborators add`](https://docs.slack.dev/tools/slack-cli/reference/commands/slack_collaborators_add)/[`remove`](https://docs.slack.dev/tools/slack-cli/reference/commands/slack_collaborators_remove)) to look up a user by email, update collaborators, and post a confirmation message. -### GitHub Actions workflow - ```js reference https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_4_Slack_CLI_Command/collaborators.yml ``` diff --git a/docs/sending-data-slack-api-method.md b/docs/sending-data-slack-api-method.md index b27f5bce..beefe999 100644 --- a/docs/sending-data-slack-api-method.md +++ b/docs/sending-data-slack-api-method.md @@ -160,11 +160,7 @@ While these outputs are returned with certain Slack API methods:
Direct message the author -This workflow sends a direct message to the user that pushed the most recent commits. - -This example uses the email of the pusher to find the user to send a message to. - -### GitHub Actions workflow +This workflow sends a direct message to the user that pushed the most recent commits. It does so by grabbing the email of the pusher. ```js reference https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_2_Slack_API_Method/author.yml @@ -175,11 +171,8 @@ https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Tech
Invite a usergroup to channel -This workflow creates a channel after a bug is reported and add members of a usergroup. - -This example chains multiple Slack API methods together to help fix bugs fast. +This workflow creates a channel after a bug is reported and add members of a usergroup by chaining multiple Slack API method calls together. -### GitHub Actions workflow ```js reference https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_2_Slack_API_Method/invite.yml diff --git a/docs/sending-data-slack-incoming-webhook.md b/docs/sending-data-slack-incoming-webhook.md index be357b7f..19552096 100644 --- a/docs/sending-data-slack-incoming-webhook.md +++ b/docs/sending-data-slack-incoming-webhook.md @@ -57,11 +57,7 @@ The following outputs are returned with each of the techniques:
Post an inline text message -This workflow writes a line of text after a push event is received. - -This example uses incoming webhooks to post a plain text message. - -### GitHub Actions workflow +This workflow uses incoming webhooks to post a plain text message. ```js reference https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_3_Slack_Incoming_Webhook/text.yml @@ -72,11 +68,7 @@ https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Tech
Post an inline block message -This workflow formats a response to recent adventures. - -This example uses incoming webhooks to post a message with Block Kit. - -### GitHub Actions workflow +This workflow uses incoming webhooks to post a message with Block Kit. ```js reference https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_3_Slack_Incoming_Webhook/blocks.yml @@ -87,17 +79,15 @@ https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Tech
Post blocks found in a file -This workflow links to the GitHub Actions job in progress. - -This example uses file data when posting to an incoming webhook. +This workflow uses file data when posting to an incoming webhook. It links to the GitHub Actions job in progress. -### Payload file being sent +Payload file being sent ```js reference https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_3_Slack_Incoming_Webhook/saved.data.json ``` -### GitHub Actions workflow +### Workflow ```js reference https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_3_Slack_Incoming_Webhook/saved.gha.yml diff --git a/docs/sending-data-webhook-slack-workflow.md b/docs/sending-data-webhook-slack-workflow.md index 32b9f16e..6e5fa0a0 100644 --- a/docs/sending-data-webhook-slack-workflow.md +++ b/docs/sending-data-webhook-slack-workflow.md @@ -88,25 +88,25 @@ This workflow converts build outputs from earlier GitHub Action steps into a Sla This example uses data from a payload file to [send a message](/tools/deno-slack-sdk/reference/slack-functions/send_message/) to a hardcoded channel. -### Payload file being sent +Payload file being sent ```js reference https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/builds.data.json ``` -### GitHub Actions workflow +GitHub Actions workflow ```js reference https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/builds.gha.yml ``` -### Slack app manifest +Slack app manifest ```js reference https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/builds.manifest.json ``` -### Slack webhook trigger +Slack webhook trigger ```js reference https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/builds.trigger.json @@ -125,19 +125,19 @@ This example uses [Slack functions](/tools/deno-slack-sdk/guides/creating-slack- 2. Send a message to the selected channel. 3. React with a `:tada:` emoji. -### GitHub Actions workflow +GitHub Actions workflow ```js reference https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/announcements.gha.yml ``` -### Slack app manifest +Slack app manifest ```js reference https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/announcements.manifest.json ``` -### Slack webhook trigger +Slack webhook trigger ```js reference https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/announcements.trigger.json @@ -152,19 +152,19 @@ This workflow shows the latest commit status in the header of a channel. This example uses the default GitHub event [context](https://github.com/actions/toolkit/blob/main/packages/github/src/context.ts#L6) and [payload](https://docs.github.com/en/webhooks/webhook-events-and-payloads) to [update a channel topic](/tools/deno-slack-sdk/reference/slack-functions/update_channel_topic/). -### GitHub Actions workflow +GitHub Actions workflow ```js reference https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/topic.gha.yml ``` -### Slack app manifest +Slack app manifest ```js reference https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/topic.manifest.json ``` -### Slack webhook trigger +Slack webhook trigger ```js reference https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_1_Slack_Workflow_Builder/topic.trigger.json diff --git a/docs/slack-github-action.md b/docs/slack-github-action.md index 83c050d4..309b4420 100644 --- a/docs/slack-github-action.md +++ b/docs/slack-github-action.md @@ -7,7 +7,7 @@ The Slack GitHub Action offers four different techniques for sending data to and * [Send data with a webhook to start a workflow in Workflow Builder](/tools/slack-github-action/sending-data-webhook-slack-workflow). * [Send data using a Slack API method and a secret token with required scopes](/tools/slack-github-action/sending-data-slack-api-method/). * [Send data as a message with a Slack incoming webhook URL](/tools/slack-github-action/sending-data-slack-incoming-webhook/). -* [Run Slack CLI commands](/tools/slack-github-action/running-slack-cli-commands/running-slack-cli-commands). +* [Run Slack CLI commands](/tools/slack-github-action/running-slack-cli-commands). --- From bdff0158cfeea4b5949eb59847f765510163347f Mon Sep 17 00:00:00 2001 From: Luke Russell Date: Tue, 14 Apr 2026 15:21:09 -0700 Subject: [PATCH 5/5] go --- docs/additional-configurations.md | 17 ----------- docs/running-slack-cli-commands.md | 31 +++++++++++---------- docs/sending-data-webhook-slack-workflow.md | 19 +++++++++++++ 3 files changed, 35 insertions(+), 32 deletions(-) diff --git a/docs/additional-configurations.md b/docs/additional-configurations.md index 19ff7dc4..c61cac1a 100644 --- a/docs/additional-configurations.md +++ b/docs/additional-configurations.md @@ -21,23 +21,6 @@ The `errors` option defaults to `false` so failed requests do not cause the step Invalid inputs to the GitHub Action, such as not including a payload, will always cause the GitHub step to fail. -## Flattening nested payloads - -Variables and data provided in the payload might contain nested fields that need to be flattened before being sent with a [webhook trigger](/tools/slack-github-action/sending-techniques/sending-data-webhook-slack-workflow) to match the expected input format of [Workflow Builder](https://slack.com/features/workflow-automation). - -The `payload-delimiter` option will flatten the input payload using the provided delimiter and will also make values stringified: - -```yaml -- name: Flatten the default GitHub payload - uses: slackapi/slack-github-action@v3.0.1 - with: - payload-delimiter: "_" - webhook: ${{ secrets.SLACK_WEBHOOK_URL }} - webhook-type: webhook-trigger -``` - -Reference to the flattening implementation is available for exploration from within the [`flat`](https://www.npmjs.com/package/flat) package. - ## Parsing templated variables Additional variables provided in the GitHub event [context](https://github.com/actions/toolkit/blob/main/packages/github/src/context.ts#L6) and event [payload](https://docs.github.com/en/webhooks/webhook-events-and-payloads) can be used to replace templated variables in the input payload with the `payload-templated` option: diff --git a/docs/running-slack-cli-commands.md b/docs/running-slack-cli-commands.md index de41bc8a..35c91c38 100644 --- a/docs/running-slack-cli-commands.md +++ b/docs/running-slack-cli-commands.md @@ -78,6 +78,17 @@ steps: token: ${{ secrets.SLACK_SERVICE_TOKEN }} ``` +
+Workflow: Validate a manifest + +This workflow validates the app manifest on pull requests to catch configuration issues early. + +```js reference +https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_4_Slack_CLI_Command/manifest.yml +``` + +
+ ### Deploy an app with a service token ```yaml @@ -89,10 +100,8 @@ steps: token: ${{ secrets.SLACK_SERVICE_TOKEN }} ``` -## Example workflows -
-Deploy an app +Workflow: Deploy an app This workflow deploys a Slack app when changes are pushed to the main branch. It uses a service token to authenticate the deploy command. @@ -102,19 +111,11 @@ https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Tech
-
-Validate a manifest - -This workflow validates the app manifest on pull requests to catch configuration issues early. - -```js reference -https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_4_Slack_CLI_Command/manifest.yml -``` - -
+### Manage collaborators
-Manage collaborators + +Workflow: Manage collaborators This workflow adds or removes an app collaborator using a manually triggered workflow. @@ -124,4 +125,4 @@ This example combines the Slack API technique ([`users.lookupByEmail`](https://d https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_4_Slack_CLI_Command/collaborators.yml ``` -
+
\ No newline at end of file diff --git a/docs/sending-data-webhook-slack-workflow.md b/docs/sending-data-webhook-slack-workflow.md index 6e5fa0a0..5729737d 100644 --- a/docs/sending-data-webhook-slack-workflow.md +++ b/docs/sending-data-webhook-slack-workflow.md @@ -67,6 +67,24 @@ Input values for the payload to be sent can also be provided in a file, either i webhook-type: webhook-trigger ``` +### Flattening nested payloads + +Variables and data provided in the payload might contain nested fields that need to be flattened before being sent with a [webhook trigger](/tools/slack-github-action/sending-data-webhook-slack-workflow) to match the expected input format of [Workflow Builder](https://slack.com/features/workflow-automation). + +The `payload-delimiter` option will flatten the input payload using the provided delimiter and will also make values stringified: + +```yaml +- name: Flatten the default GitHub payload + uses: slackapi/slack-github-action@v3.0.1 + with: + payload-delimiter: "_" + webhook: ${{ secrets.SLACK_WEBHOOK_URL }} + webhook-type: webhook-trigger +``` + +Reference to the flattening implementation is available for exploration from within the [`flat`](https://www.npmjs.com/package/flat) package. + + ## Expected outputs The technique, like all Slack Github Action techniques, [outputs values](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/passing-information-between-jobs) that can be used as inputs in following steps of a GitHub workflow. @@ -79,6 +97,7 @@ The following outputs are returned with each of the techniques: | `ok` | `boolean` | If the request completed with success. | `response` | `string` | The [response](/apis/web-api/#responses) from the request as stringified JSON. + ## Example workflows