slack-logs 3.0.4 → 3.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,6 +78,29 @@ slack.logBlockMessage("Validation Message!", payload);
|
|
|
78
78
|
- if `slackLogConfig(...)` is used, env values are ignored for both fields
|
|
79
79
|
- `slackLogConfig(...)` does not ask for values interactively
|
|
80
80
|
|
|
81
|
+
### Required Slack webhook setup
|
|
82
|
+
|
|
83
|
+
- credential required: `Incoming Webhook URL`
|
|
84
|
+
- URL format: `https://hooks.slack.com/services/...`
|
|
85
|
+
- where to find it: Slack App Settings -> `Incoming Webhooks` -> `Webhook URLs for Your Workspace`
|
|
86
|
+
- enable `Incoming Webhooks` first in the app settings
|
|
87
|
+
- each webhook URL is tied to one Slack channel
|
|
88
|
+
- if you need different channels, create separate webhook URLs or use `slackbot`
|
|
89
|
+
|
|
90
|
+
### Create the Slack app / webhook if you don't have one
|
|
91
|
+
|
|
92
|
+
1. Go to `https://api.slack.com/apps`
|
|
93
|
+
2. Click `Create New App`
|
|
94
|
+
3. Select `From scratch`
|
|
95
|
+
4. Enter the app name and choose the workspace
|
|
96
|
+
5. Open `Incoming Webhooks`
|
|
97
|
+
6. Turn on `Activate Incoming Webhooks`
|
|
98
|
+
7. Click `Add New Webhook to Workspace`
|
|
99
|
+
8. Select the Slack channel
|
|
100
|
+
9. Click `Allow`
|
|
101
|
+
10. Copy the webhook URL from `Webhook URLs for Your Workspace`
|
|
102
|
+
11. Use it in `slackLogConfig({ webhookUrl: "..." })` or `SLACK_WEBHOOK_URL`
|
|
103
|
+
|
|
81
104
|
#### Option 2: Use environment variables
|
|
82
105
|
|
|
83
106
|
Use env values only when `slackLogConfig(...)` is not called.
|
|
@@ -294,6 +317,19 @@ slackBotConfig({
|
|
|
294
317
|
- `defaultChannelId` is optional if you pass `channelId` in method calls
|
|
295
318
|
- if `defaultChannelId` is not set in config, package falls back to `SLACK_BOT_DEFAULT_CHANNEL_ID`
|
|
296
319
|
|
|
320
|
+
### Required Slack app setup
|
|
321
|
+
|
|
322
|
+
- token required: `Bot User OAuth Access Token`
|
|
323
|
+
- token format: `xoxb-...`
|
|
324
|
+
- where to find it: Slack App Settings -> `OAuth & Permissions` -> `Bot User OAuth Access Token`
|
|
325
|
+
- important: the token appears only after you click `Install to Workspace`
|
|
326
|
+
- add scopes under `OAuth & Permissions` -> `Bot Token Scopes`
|
|
327
|
+
- required scope: `chat:write`
|
|
328
|
+
- optional scope: `chat:write.public` if you want to post in public channels without inviting the app first
|
|
329
|
+
- do not use `User Token Scopes`
|
|
330
|
+
- do not use app-level tokens (`xapp-...`) for this package
|
|
331
|
+
- if the app is not in a channel, invite it first unless you added `chat:write.public`
|
|
332
|
+
|
|
297
333
|
### Environment variables
|
|
298
334
|
|
|
299
335
|
Use env values only when `slackBotConfig(...)` is not called.
|
|
@@ -313,6 +349,19 @@ ENABLE_SLACK_BOT_LOGS=true
|
|
|
313
349
|
...
|
|
314
350
|
```
|
|
315
351
|
|
|
352
|
+
### Create the Slack app if you don't have one
|
|
353
|
+
|
|
354
|
+
1. Go to `https://api.slack.com/apps`
|
|
355
|
+
2. Click `Create New App`
|
|
356
|
+
3. Select `From scratch`
|
|
357
|
+
4. Enter the app name and choose the workspace
|
|
358
|
+
5. Open `OAuth & Permissions`
|
|
359
|
+
6. Under `Bot Token Scopes`, add `chat:write`
|
|
360
|
+
7. Optional: add `chat:write.public`
|
|
361
|
+
8. Click `Install to Workspace`
|
|
362
|
+
9. Copy the `Bot User OAuth Access Token` (`xoxb-...`)
|
|
363
|
+
10. Use it in `slackBotConfig({ botToken: "xoxb-..." })` or `SLACK_BOT_TOKEN`
|
|
364
|
+
|
|
316
365
|
### Methods
|
|
317
366
|
|
|
318
367
|
```
|