@qomodome/node-red-slack 1.0.0
Node-RED nodes for calling Slack Web API with reusable token config
node-red-slack
Node-RED nodes to call Slack Web API methods with a reusable bot token config.
What you get
slack-config: stores one Slack bot token (xoxb-...) and reuses it across flows.slack-api: generic Slack API caller.- No runtime dependencies outside Node.js built-ins.
Requirements
- Node.js 18+
- Node-RED 3+
- A Slack bot token with the scopes required by the API methods you call
Installation
From the Node-RED editor:
- Go to
Manage palette>Installtab - Search for
@qomodome/node-red-slack - Click
Install
From the command line:
npm install @qomodome/node-red-slack
Use the node
- Add a
slack-confignode and set your bot token. - Add a
slack-apinode and link it to that config. - Send a message where:
msg.topic = "chat.postMessage";
msg.payload = {
channel: "#my-channel",
text: "Hello from Node-RED"
};
return msg;
If msg.topic is missing, slack-api uses its Default Method field.
Node reference
slack-config
name(optional): label in editortoken(required): Slack bot token
slack-api
slack config(required): reference toslack-configdefault method(optional): fallback method whenmsg.topicis emptydefault channel(optional): fallback channel whenmsg.payload.channelis missing or empty
Message contract
Input:
msg.topic(string): Slack method, for examplechat.postMessagemsg.payload(object): request body sent to Slackmsg.payload.channel(optional): if provided, overrides the nodedefault channel
Output on success:
msg.payload: Slack response body (parsed JSON when possible)msg.slack:methodstatusCodeok
Error behavior:
- Emits
node.error(err, msg)and callsdone(err) - Fails when config/token/method is missing
- Fails when
msg.payloadis not an object - Fails on HTTP status
>= 400 - Fails when Slack responds with
ok: false - No built-in retry/backoff
Use Node-RED catch nodes and your own flow logic for retries and recovery.
Local Docker run
From repository root:
docker compose up --build
Then open:
http://localhost:1880
Notes:
- This setup auto-installs the local module into
/data/node_modules. - Flows persist in a named Docker volume mounted at
/data. - Rebuild after source changes:
docker compose up --build --force-recreate
Development
Run tests:
npm test
Create package tarball:
npm pack
Publishing
The publish process is automated via GitHub Actions when pushing a tag that matches the package.json version. To publish a new version:
npm version X.Y.Z
git push origin X.Y.Z
For manual publish (not recommended - use only for emergencies):
- Verify you have an npm account and are logged in with
npm whoami. If not, runnpm login --scope=@qomodome --auth-type=weband follow the prompts. - Update version in
package.json - Verify contents with
npm pack --dry-run - Publish to npm:
npm publish --access public
License
MIT License. See LICENSE for details.