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: .github/cli-sdk-specification.md
+19-19Lines changed: 19 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ Some hooks may return data as part of their functionality. The CLI will use the
50
50
51
51
### ↪️ Discover hook scripts and default configuration with `get-hooks`
52
52
53
-
In order for the CLI to reliably discover the hooks for the [Deno SDK](https://github.com/slackapi/deno-slack-sdk/), [Bolt Frameworks](https://api.slack.com/tools), and future community-driven SDKs, the CLI employs a service-discovery-like approach to querying the SDK for what functionality it supports.
53
+
In order for the CLI to reliably discover the hooks for the [Deno SDK](https://github.com/slackapi/deno-slack-sdk), [Bolt Frameworks](https://tools.slack.dev), and future community-driven SDKs, the CLI employs a service-discovery-like approach to querying the SDK for what functionality it supports.
54
54
55
55
A project includes a `hooks.json` file in its `.slack` directory which by default contains a single hook (`get-hooks`). The SDK is responsible for implementing this hook and returning to the CLI a JSON object with all hook definitions and their relevant default configuration (one hook to rule them all 💍).
56
56
@@ -95,7 +95,7 @@ For example, the hook name `run-v2` may be the successor to the hook named `run`
95
95
96
96
## 📄 Hook Specification
97
97
98
-
Hooks are entry points for the CLI to initiate inter-process communication with the SDK. SDKs should implement one hook: `get-hooks`. It is the recommended approach for SDKs to enable communication with the CLI (for more details, see the [Hook Resolution](#hook-resolution) section).
98
+
Hooks are entry points for the CLI to initiate inter-process communication with the SDK. SDKs should implement one hook: `get-hooks`. It is the recommended approach for SDKs to enable communication with the CLI (for more details, see the [Hook Resolution](#hook-resolution) section).
99
99
100
100
A hook encapsulates an isolated piece of functionality that the SDK provides to app developers; the CLI delegates execution of the functionality to the SDK via hook invocation in a separate process. SDKs are responsible for ensuring that hook processes exit with a status code of 0; otherwise the CLI will surface the `sdk_hook_invocation_failed` error to the end-user and report the hook process’ `STDOUT` and `STDERR` to the CLI process’ `STDOUT`.
101
101
@@ -137,11 +137,11 @@ This hook should return the CLI-SDK interface in [JSON](#interface-format) forma
137
137
138
138
This hook allows for the application under development to be created on `api.slack.com/apps` as well as installed to workspaces that the CLI has been authorized to.
139
139
140
-
Implementing this hook signals to the CLI that the SDK manages the [application manifest](https://api.slack.com/concepts/manifests#fields). Even if this hook is not present, the CLI should fall back to checking if a `manifest.json` or `manifest.yaml` exists in the project directory and read that file directly.
140
+
Implementing this hook signals to the CLI that the SDK manages the [application manifest](https://docs.slack.dev/app-manifests/). Even if this hook is not present, the CLI should fall back to checking if a `manifest.json` or `manifest.yaml` exists in the project directory and read that file directly.
141
141
142
142
#### Output
143
143
144
-
The [application manifest](https://api.slack.com/concepts/manifests#fields) in JSON format to `STDOUT`.
144
+
The [app manifest](https://docs.slack.dev/reference/app-manifest) in JSON format to `STDOUT`.
145
145
146
146
#### Support
147
147
| Deno | Bolt JS | Bolt Python | Bolt Java |
@@ -150,7 +150,7 @@ The [application manifest](https://api.slack.com/concepts/manifests#fields) in J
150
150
151
151
### 🪝 `build` (optional)
152
152
153
-
Implementing this hook allows for the CLI to [deploy function code to Slack's managed infrastructure](https://api.slack.com/automation/deploy). The work of assembling the application bundle according to Slack's application bundle format is delegated to the SDK via this hook.
153
+
Implementing this hook allows for the CLI to [deploy function code to Slack's managed infrastructure](https://tools.slack.dev/deno-slack-sdk/guides/deploying-to-slack). The work of assembling the application bundle according to Slack's application bundle format is delegated to the SDK via this hook.
154
154
155
155
The application bundle format has few restrictions, but the critical ones are:
156
156
- It must have a `manifest.json` at the root of the package
@@ -159,9 +159,9 @@ The application bundle format has few restrictions, but the critical ones are:
159
159
160
160
The above requirements come from the [deno-slack-runtime](https://github.com/slackapi/deno-slack-runtime) project, which implements the expected Slack deployment bundle format. It contains a hard-coded [reference](https://github.com/slackapi/deno-slack-runtime/blob/main/src/mod.ts#L73) to the above-mentioned `functions/` sub-directory, and combines it with the [specific custom function `callback_id`](https://github.com/slackapi/deno-slack-runtime/blob/main/src/mod.ts#L17-L19) to resolve an import path for userland function source code.
161
161
162
-
*Note: This hook should only be implemented by official Slack SDKs and is only relevant to apps [deployed to Slack's managed infrastructure](https://api.slack.com/automation/deploy).*
162
+
*Note: This hook should only be implemented by official Slack SDKs and is only relevant to apps [deployed to Slack's managed infrastructure](https://tools.slack.dev/deno-slack-sdk/guides/deploying-to-slack).*
163
163
164
-
#### Input
164
+
#### Input
165
165
166
166
Two command-line flags are provided as part of the hook invocation:
167
167
-`--source`: the path to the root of the application project directory
@@ -178,13 +178,13 @@ No further output over STDOUT required from the SDK other than writing the appli
178
178
179
179
### 🪝 `start` (optional)
180
180
181
-
The `slack run` CLI command will invoke the `start` hook to initiate a local-run development mode allowing for quick iteration during app development. This hook is responsible for actually running the app, but has two operating modes: one where the hook manages the connection to Slack via [Socket Mode](https://api.slack.com/apis/connections/socket), and one where it does not. Which mode should be employed by the CLI when invoking this hook is dictated by the `config.sdk-managed-connection-enabled` property in the response from [`get-hooks`](#get-hooks).
181
+
The `slack run` CLI command will invoke the `start` hook to initiate a local-run development mode allowing for quick iteration during app development. This hook is responsible for actually running the app, but has two operating modes: one where the hook manages the connection to Slack via [Socket Mode](https://docs.slack.dev/apis/events-api/using-socket-mode/), and one where it does not. Which mode should be employed by the CLI when invoking this hook is dictated by the `config.sdk-managed-connection-enabled` property in the response from [`get-hooks`](#get-hooks).
182
182
183
183
#### Non-SDK-managed connection
184
184
185
185
This section applies when `config.sdk-managed-connection-enabled` is undefined or set to `false` in `hooks.json` or in the [`get-hooks`](#get-hooks) hook response.
186
186
187
-
When the app developer wants to initiate a development-mode local run of their application via the `slack run` CLI command, by default the CLI will create a [Socket Mode](https://api.slack.com/apis/connections/socket) connection to the Slack backend and start listening for events on behalf of the app.
187
+
When the app developer wants to initiate a development-mode local run of their application via the `slack run` CLI command, by default the CLI will create a [Socket Mode](https://docs.slack.dev/apis/events-api/using-socket-mode/) connection to the Slack backend and start listening for events on behalf of the app.
188
188
189
189
Any events coming down the wire from Slack will be fed over `STDIN` to this hook for the SDK to process. *Each event incoming from Slack will invoke this hook independently*, meaning one `start` hook process will be spawned per incoming event. The SDK should process each incoming event and output a JSON object to `STDOUT` representing the response to send back to Slack over the socket connection managed by the CLI.
190
190
@@ -207,7 +207,7 @@ Several parameters are passed to the SDK over `STDIN` as JSON. The format of thi
207
207
208
208
| Field | Description | Required |
209
209
| ------- | ----------- | -------- |
210
-
| body | Object whose keys represent the incoming Slack event payload as described in [Events API Event Types](https://api.slack.com/events?filter=Events). The particular content of this key is dependent on the incoming event type. | Yes |
210
+
| body | Object whose keys represent the incoming Slack event payload as described in [Events API Event Types](https://docs.slack.dev/reference/events?APIs=Events). The particular content of this key is dependent on the incoming event type. | Yes |
211
211
| context | Object representing variables relevant for the locally-running application. | Yes |
212
212
| context.bot_access_token | String; a bot access token that the SDK can provide to developer functions for issuing calls to the Slack API. | Yes |
213
213
| context.app_id | String; the current application ID. | Yes |
@@ -218,7 +218,7 @@ Note: The CLI always provides the `SLACK_APP_TOKEN` and `SLACK_BOT_TOKEN` enviro
218
218
219
219
##### Output
220
220
221
-
Each incoming event from the socket connection will invoke this hook separately. As such, this hook's response to `STDOUT` should be the JSON response to the Slack event sent to the app. The CLI will handle [acknowledging events](https://api.slack.com/apis/connections/socket#acknowledge) by sending back the proper `envelope_id` attribute to the Slack backend. Therefore, the SDK’s `start` hook response `STDOUT` should be the `payload` of the response and nothing else. It is recommended to use the `v2` (`message-boundaries`) [protocol](#protocol) to more easily delineate logging/diagnostics from event responses to be sent to Slack.
221
+
Each incoming event from the socket connection will invoke this hook separately. As such, this hook's response to `STDOUT` should be the JSON response to the Slack event sent to the app. The CLI will handle [acknowledging events](https://docs.slack.dev/apis/events-api/using-socket-mode/#acknowledge) by sending back the proper `envelope_id` attribute to the Slack backend. Therefore, the SDK’s `start` hook response `STDOUT` should be the `payload` of the response and nothing else. It is recommended to use the `v2` (`message-boundaries`) [protocol](#protocol) to more easily delineate logging/diagnostics from event responses to be sent to Slack.
222
222
223
223
##### Support
224
224
| Deno | Bolt JS | Bolt Python | Bolt Java |
@@ -229,11 +229,11 @@ Each incoming event from the socket connection will invoke this hook separately.
229
229
230
230
This section applies when `config.sdk-managed-connection-enabled` is set to `true` in `hooks.json` or in the [`get-hooks`](#get-hooks) hook response.
231
231
232
-
Implementing the `start` hook with `config.sdk-managed-connection-enabled` set to `true` will instruct the CLI to delegate connection management to the hook implementation as defined in our [Implementing Socket Mode documentation](https://api.slack.com/apis/connections/socket#implementing). Because establishing a network connection and handling incoming events is assumed to be a long-running process, invoking this hook will block the CLI process.
232
+
Implementing the `start` hook with `config.sdk-managed-connection-enabled` set to `true` will instruct the CLI to delegate connection management to the hook implementation as defined in our [Implementing Socket Mode documentation](https://docs.slack.dev/apis/events-api/using-socket-mode/#implementing). Because establishing a network connection and handling incoming events is assumed to be a long-running process, invoking this hook will block the CLI process.
233
233
234
234
##### Input
235
235
236
-
The application's app-level token and bot access token will be provided as environment variables to the hook process (`SLACK_CLI_XAPP` and `SLACK_CLI_XOXB` respectively, as well as `SLACK_APP_TOKEN` and `SLACK_BOT_TOKEN`). The SDK should use the app token to [create a socket connection](https://api.slack.com/apis/connections/socket#call) with the Slack backend on behalf of the app. Additionally, the SDK may use the provided bot token to facilitate API calls to the Slack API.
236
+
The application's app-level token and bot access token will be provided as environment variables to the hook process (`SLACK_CLI_XAPP` and `SLACK_CLI_XOXB` respectively, as well as `SLACK_APP_TOKEN` and `SLACK_BOT_TOKEN`). The SDK should use the app token to [create a socket connection](https://docs.slack.dev/apis/events-api/using-socket-mode/#call) with the Slack backend on behalf of the app. Additionally, the SDK may use the provided bot token to facilitate API calls to the Slack API.
237
237
238
238
All Bolt SDKs leverage this `start` hook operating mode.
239
239
@@ -428,7 +428,7 @@ This script is provided by the developer and is meant to simplify app management
428
428
429
429
If this script isn't provided, an attempt is made to deploy the app to Slack's managed infrastructure. This is expected for Deno apps but will fail for Bolt apps.
430
430
431
-
#### Input
431
+
#### Input
432
432
433
433
Access to `STDIN` is necessary for certain scripts.
434
434
@@ -538,7 +538,7 @@ The CLI will employ the following algorithm in order to resolve the command to b
538
538
}
539
539
}
540
540
```
541
-
#### Complete example returned by SDK from the get-hooks script implemented by Deno SDK (this is in-memory)
541
+
#### Complete example returned by SDK from the get-hooks script implemented by Deno SDK (this is in-memory)
542
542
```
543
543
{
544
544
"runtime": "deno",
@@ -565,17 +565,17 @@ The CLI will employ the following algorithm in order to resolve the command to b
565
565
### Types of developers
566
566
567
567
1. App Developers are using the CLI and SDK to create and build a project
568
-
2. SDK Developers are building and maintaining the CLI and/or SDKs (controlled by Slack or community-driven)
568
+
2. SDK Developers are building and maintaining the CLI and/or SDKs (controlled by Slack or community-driven)
569
569
570
570
### Types of SDKs
571
571
572
-
1. Slack Deno SDK - Run on Slack
572
+
1. Slack Deno SDK - Run on Slack
573
573
2. Bolt Frameworks (JavaScript, Python, and Java) - Remote using Slack's Bolt Framework
574
574
3. No SDK at all - Run on Slack, Remote Self-Hosted
575
575
4. Community SDKs, frameworks, and custom apps (e.g. Ruby, Golang, etc), if they exist
576
576
577
577
### Other definitions
578
578
579
-
* hooks.json - The CLI-SDK Interface implemented as a JSON object ({...}) or JSON file (hooks.json).
579
+
* hooks.json - The CLI-SDK Interface implemented as a JSON object ({...}) or JSON file (hooks.json).
580
580
* command - This refers to a CLI command, eg. `slack doctor`
581
-
* hook - This refers to some CLI functionality delegated to the SDK and is defined at the level of the hooks.json file
581
+
* hook - This refers to some CLI functionality delegated to the SDK and is defined at the level of the hooks.json file
0 commit comments