@slack/webhook
Advanced tools
Comparing version 6.1.0 to 7.0.0
@@ -16,3 +16,3 @@ /// <reference types="node" /> | ||
} | ||
export declare type IncomingWebhookSendError = IncomingWebhookRequestError | IncomingWebhookHTTPError; | ||
export type IncomingWebhookSendError = IncomingWebhookRequestError | IncomingWebhookHTTPError; | ||
export interface IncomingWebhookRequestError extends CodedError { | ||
@@ -19,0 +19,0 @@ code: ErrorCode.RequestError; |
@@ -46,2 +46,6 @@ /// <reference types="node" /> | ||
unfurl_media?: boolean; | ||
metadata?: { | ||
event_type: string; | ||
event_payload: Record<string, any>; | ||
}; | ||
} | ||
@@ -48,0 +52,0 @@ export interface IncomingWebhookResult { |
@@ -30,2 +30,3 @@ "use strict"; | ||
headers: { | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
'User-Agent': (0, instrument_1.getUserAgent)(), | ||
@@ -52,2 +53,3 @@ }, | ||
return this.buildResult(response); | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
} | ||
@@ -54,0 +56,0 @@ catch (error) { |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
{ | ||
"name": "@slack/webhook", | ||
"version": "6.1.0", | ||
"version": "7.0.0", | ||
"description": "Official library for using the Slack Platform's Incoming Webhooks", | ||
@@ -21,4 +21,4 @@ "author": "Slack Technologies, LLC", | ||
"engines": { | ||
"node": ">= 12.13.0", | ||
"npm": ">= 6.12.0" | ||
"node": ">= 18", | ||
"npm": ">= 8.6.0" | ||
}, | ||
@@ -38,34 +38,34 @@ "repository": "slackapi/node-slack-sdk", | ||
"lint": "eslint --ext .ts src", | ||
"test": "npm run lint && npm run build && nyc mocha --config .mocharc.json src/*.spec.js", | ||
"coverage": "codecov -F webhook --root=$PWD", | ||
"mocha": "mocha --config .mocharc.json src/*.spec.js", | ||
"test": "npm run lint && npm run test:unit", | ||
"test:unit": "npm run build && nyc --reporter=text-summary npm run mocha", | ||
"ref-docs:model": "api-extractor run" | ||
}, | ||
"dependencies": { | ||
"@slack/types": "^1.2.1", | ||
"@types/node": ">=12.0.0", | ||
"axios": "^0.21.4" | ||
"@slack/types": "^2.9.0", | ||
"@types/node": ">=18.0.0", | ||
"axios": "^1.5.1" | ||
}, | ||
"devDependencies": { | ||
"@microsoft/api-extractor": "^7.3.4", | ||
"@typescript-eslint/eslint-plugin": "^4.4.1", | ||
"@typescript-eslint/parser": "^4.4.0", | ||
"@types/chai": "^4.1.7", | ||
"@types/mocha": "^5.2.6", | ||
"chai": "^4.2.0", | ||
"codecov": "^3.2.0", | ||
"eslint": "^7.32.0", | ||
"eslint-config-airbnb-base": "^14.2.1", | ||
"eslint-config-airbnb-typescript": "^12.3.1", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-jsdoc": "^30.6.1", | ||
"@microsoft/api-extractor": "^7.38.0", | ||
"@typescript-eslint/eslint-plugin": "^6.4.1", | ||
"@typescript-eslint/parser": "^6.4.0", | ||
"@types/chai": "^4.3.5", | ||
"@types/mocha": "^10.0.1", | ||
"chai": "^4.3.8", | ||
"eslint": "^8.47.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-config-airbnb-typescript": "^17.1.0", | ||
"eslint-plugin-import": "^2.28.1", | ||
"eslint-plugin-jsdoc": "^46.5.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"mocha": "^9.1.0", | ||
"nock": "^13.0.0", | ||
"nyc": "^14.1.1", | ||
"mocha": "^10.2.0", | ||
"nock": "^13.3.3", | ||
"nyc": "^15.1.0", | ||
"shx": "^0.3.2", | ||
"sinon": "^7.2.7", | ||
"source-map-support": "^0.5.10", | ||
"ts-node": "^8.0.3", | ||
"sinon": "^15.2.0", | ||
"source-map-support": "^0.5.21", | ||
"ts-node": "^8.2.0", | ||
"typescript": "^4.1.0" | ||
} | ||
} |
# Slack Incoming Webhooks | ||
The `@slack/webhook` package contains a helper for making requests to Slack's [Incoming | ||
Webhooks](https://api.slack.com/incoming-webhooks). Use it in your app to send a notification to a channel. | ||
Webhooks](https://api.slack.com/messaging/webhooks). Use it in your app to send a notification to a channel. | ||
## Requirements | ||
This package supports Node v18 and higher. It's highly recommended to use [the latest LTS version of | ||
node](https://github.com/nodejs/Release#release-schedule), and the documentation is written using syntax and features | ||
from that version. | ||
## Installation | ||
@@ -18,12 +23,8 @@ | ||
--- | ||
### Initialize the webhook | ||
The package exports a `IncomingWebhook` class. You'll need to initialize it with the URL you received from Slack. | ||
The package exports an `IncomingWebhook` class. You'll need to initialize it with the URL you received from Slack. | ||
To create a webhook URL, follow the instructions in the [Getting started with Incoming Webhooks](https://api.slack.com/messaging/webhooks#getting_started) | ||
guide. | ||
The URL can come from installation in your development workspace, which is shown right in the app configuration pages. | ||
Or, the URL could be in the response from [`oauth.v2.access`](https://api.slack.com/methods/oauth.v2.access) when the app is | ||
distributed and installed into another workspace. | ||
```javascript | ||
@@ -63,3 +64,3 @@ const { IncomingWebhook } = require('@slack/webhook'); | ||
Something interesting just happened in your app, so its time to send the notification! Just call the | ||
Something interesting just happened in your app, so it's time to send the notification! Just call the | ||
`.send(options)` method on the webhook. The `options` parameter is an object that should describe the contents of | ||
@@ -88,3 +89,3 @@ the message. The method returns a `Promise` that resolves once the notification is sent. | ||
[`Agent`](https://nodejs.org/docs/latest/api/http.html#http_class_http_agent) used to create the connection to Slack. | ||
Using this option is the best way to make all requests from your app through a proxy, which is a common requirement in | ||
Using this option is the best way to make all requests from your app go through a proxy, which is a common requirement in | ||
many corporate settings. | ||
@@ -105,3 +106,3 @@ | ||
const { IncomingWebhook } = require('@slack/webhook'); | ||
const HttpsProxyAgent = require('https-proxy-agent'); | ||
const { HttpsProxyAgent } = require('https-proxy-agent'); | ||
const url = process.env.SLACK_WEBHOOK_URL; | ||
@@ -108,0 +109,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
22640
20
286
120
0
+ Added@slack/types@2.14.0(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaxios@1.7.9(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedproxy-from-env@1.1.0(transitive)
- Removed@slack/types@1.10.0(transitive)
- Removedaxios@0.21.4(transitive)
Updated@slack/types@^2.9.0
Updated@types/node@>=18.0.0
Updatedaxios@^1.5.1