slack-logs 1.0.10 → 1.0.12

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.
Files changed (2) hide show
  1. package/README.md +64 -0
  2. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,64 @@
1
+ ## Slack Log Package
2
+
3
+ ### Description
4
+
5
+ This package provides a simple and efficient way to log messages directly to Slack from your Node.js applications. Utilizing Slack's Incoming Webhooks, it allows for real-time notifications and logging of critical events, errors, or any custom messages you choose to send to your Slack channel.
6
+
7
+ ### Features
8
+
9
+ - Easy integration with Slack via Incoming Webhooks.
10
+ - Supports custom messages with dynamic data.
11
+ - Validates Slack webhook URLs before attempting to send messages.
12
+ - Asynchronous logging with async/await support.
13
+ - Configurable to fit various logging needs.
14
+
15
+ ### Installation
16
+
17
+ Install the package using npm:
18
+ `npm install slack-logs`
19
+ Or using yarn:
20
+ `yarn add slack-logs`
21
+
22
+ ### Configuration:
23
+
24
+ Before you start, ensure you have created an Incoming Webhook in Slack and have the webhook URL ready. For more information on setting up Incoming Webhooks in Slack, visit [Slack's API documentation.](https://api.slack.com/messaging/webhooks)
25
+
26
+ ### Usage
27
+
28
+ Here is a basic example of how to use the Slack Log package to send a message to your Slack channel:
29
+
30
+ .env 🚨
31
+
32
+ ```
33
+ ...
34
+ SLACK_WEBHOOK_URL="https://hooks.slack.com/services/******/******/********************"
35
+ ...
36
+ ```
37
+
38
+ ```
39
+ import { slack } from "slack-logs";
40
+ or
41
+ const { SlackLogger } = require('slack-logs');
42
+
43
+ /*Slack Notification with default format*/
44
+ slack.log("Data", [{ title: "1yes!" }]);
45
+ slack.log("Data", { title: "2yes!" });
46
+ slack.log("Data", "Hello world!");
47
+
48
+ /*Slack Notification with block format*/
49
+ const payload = [
50
+ { title: "Title 1", value: "1234" },
51
+ { title: "Title 2", value: 123 },
52
+ { title: "Title 3", value: { id: 12 } },
53
+ { title: "Title 3", value: [{ id: 12 }] },
54
+ ];
55
+ slack.logBlockMessage("Validation Message!", payload);
56
+ ```
57
+
58
+ ### Contributing
59
+
60
+ Contributions are welcome! If you have a feature request, bug report, or a pull request, please open an issue or submit a PR on the GitHub repository
61
+
62
+ ### License:
63
+
64
+ This package is licensed under the MIT License - see the LICENSE file for details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slack-logs",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "slack-logs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.ts",
@@ -15,10 +15,10 @@
15
15
  "axios": "^1.6.7"
16
16
  },
17
17
  "keywords": [
18
- "slack",
19
- "logs",
20
18
  "slack-logs",
21
19
  "slack-logger",
20
+ "slack",
21
+ "logs",
22
22
  "logger",
23
23
  "console",
24
24
  "console logs",