You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/additional-configurations.md
-17Lines changed: 0 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,23 +21,6 @@ The `errors` option defaults to `false` so failed requests do not cause the step
21
21
22
22
Invalid inputs to the GitHub Action, such as not including a payload, will always cause the GitHub step to fail.
23
23
24
-
## Flattening nested payloads
25
-
26
-
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).
27
-
28
-
The `payload-delimiter` option will flatten the input payload using the provided delimiter and will also make values stringified:
29
-
30
-
```yaml
31
-
- name: Flatten the default GitHub payload
32
-
uses: slackapi/slack-github-action@v3.0.1
33
-
with:
34
-
payload-delimiter: "_"
35
-
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
36
-
webhook-type: webhook-trigger
37
-
```
38
-
39
-
Reference to the flattening implementation is available for exploration from within the [`flat`](https://www.npmjs.com/package/flat) package.
40
-
41
24
## Parsing templated variables
42
25
43
26
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:
Copy file name to clipboardExpand all lines: docs/gathering-variables.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
# Sending variables
1
+
# Gathering variables
2
2
3
-
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.
3
+
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.
4
4
5
5
You can provide data to send to Slack from this GitHub Action and either source:
This workflow adds or removes an app collaborator using a manually triggered workflow.
121
+
122
+
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.
* [**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.
99
-
* [**Validate a manifest**](/tools/slack-github-action/sending-techniques/running-slack-cli-commands/validate-a-manifest): Check the app manifest on pull requests.
100
-
* [**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.
Copy file name to clipboardExpand all lines: docs/sending-data-slack-api-method.md
+42-6Lines changed: 42 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,3 @@
1
-
---
2
-
sidebar_label: Overview
3
-
---
4
-
5
1
# Sending data using a Slack API method
6
2
7
3
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,47 @@ Calling [a Slack API method](/reference/methods) with [`@slack/web-api`](/tools/
139
135
filename: "results-${{ github.sha }}.out"
140
136
```
141
137
138
+
## Expected outputs
139
+
140
+
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.
141
+
142
+
The following outputs are returned with each of the techniques:
143
+
144
+
| Output | Type | Description|
145
+
|---|---|---|
146
+
|`time` | `number` | The Unix [epoch time](https://en.wikipedia.org/wiki/Unix_time) that the step completed.
147
+
| `ok` | `boolean` | If the request completed with success.
148
+
| `response` | `string` | The [response](/apis/web-api/#responses) from the request as stringified JSON.
149
+
150
+
While these outputs are returned with certain Slack API methods:
151
+
152
+
| Output | Type | Description|
153
+
|---|---|---|
154
+
|`channel_id` | `string` | The [channel ID](/reference/objects/conversation-object) included in the response.
155
+
| `ts`| `string` | The [timestamp](/messaging/retrieving-messages#individual_messages) of the Slack event or message.
156
+
| `thread_ts` | `string` | The [timestamp](/messaging/retrieving-messages#individual_messages) of a parent Slack message with [threaded replies](/messaging/retrieving-messages#pulling_threads).
157
+
142
158
## Example workflows
143
159
144
-
- [**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.
145
-
- [**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.
160
+
<details>
161
+
<summary><strong>Direct message the author</strong></summary>
162
+
163
+
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.
Copy file name to clipboardExpand all lines: docs/sending-data-slack-incoming-webhook.md
+52-7Lines changed: 52 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,3 @@
1
-
---
2
-
sidebar_label: Overview
3
-
---
4
-
5
1
# Sending data as a message with a Slack incoming webhook URL
6
2
7
3
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,57 @@ Add the collected webhook from above to a GitHub workflow and configure the step
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.
46
+
47
+
The following outputs are returned with each of the techniques:
48
+
49
+
| Output | Type | Description|
50
+
|---|---|---|
51
+
|`time` | `number` | The Unix [epoch time](https://en.wikipedia.org/wiki/Unix_time) that the step completed.
52
+
| `ok` | `boolean` | If the request completed with success.
53
+
| `response` | `string` | The [response](/apis/web-api/#responses) from the request as stringified JSON.
54
+
47
55
## Example workflows
48
56
49
-
* [**Post an inline text message**](/tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/post-inline-text-message)
50
-
* [**Post an inline block message**](/tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/post-inline-block-message)
51
-
* [**Post blocks found in a file**](/tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/post-blocks-found-in-file)
57
+
<details>
58
+
<summary><strong>Post an inline text message</strong></summary>
59
+
60
+
This workflow uses incoming webhooks to post a plain text message.
0 commit comments