
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
slack-payload
Advanced tools
A wrapper for Slack payloads to make working with events easier and consistent across events
A lightweight wrapper for Slack payloads to make working with events easier and consistent across schemas.
Slack has many events that POST to HTTPS endpoints, including Slash Commands, Events API, and Interactive Messages. Each payload schema is slightly different and adds additional if/then logic to your endpoint functions.
Let's use user_id as an example. If your endpoint needs this id, your logic might look something like this:
function getUserId(payload) {
// Interactive Messages
if (payload.user) return payload.user.id
// Slash Commands
if (payload.user_id) return payload.user_id
// Events API
if (payload.event && payload.event.user) return payload.event.user
if (payload.event && payload.event.item) return payload.event.item.user
}
Sometimes even the payload itself requires work to use since it can be encoded then included in the payload field.
if (event.payload)
payload = JSON.parse(event.payload)
const Payload = require('slack-payload'),
app.post('/slack', (req, res) => {
let payload = new Payload(req.body)
// returns the message text no matter the event type
let text = payload.text
// check for the event type or values
let isCommand = payload.is('slash_command')
let isButtonClick = payload.is('message_button')
let isButtonValue = payload.is('my_button_value')
// perform regex on text messages
let match = payload.match(/lunch/i)
// determine if the event was caused by a bot
let bot_id = payload.bot_id
})
| Property | Description |
|---|---|
text | The message text associated with the event |
team_id | The team id the payload was sent from |
channel_id | The channel id the payload was sent from |
user_id | The user id that sent the payload (if available) |
bot_id | The bot id that sent the payload (if available) |
selection | The selected interactive message option |
action | The selected interactive message action |
types | An array of all types associated with this payload (includes a wildcard) |
| Function | Parameter | Description |
|---|---|---|
is | event type [String] | Checks if the payload matches an event type. Get a full list of events here |
match | regex | Matches the text with a regular expression |
npm i slack-payload
FAQs
A wrapper for Slack payloads to make working with events easier and consistent across events
The npm package slack-payload receives a total of 214 weekly downloads. As such, slack-payload popularity was classified as not popular.
We found that slack-payload demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.