From b5c5ccdfaf390f002e0e3ffcfddab4e729c1622a Mon Sep 17 00:00:00 2001 From: David Hohl Date: Thu, 21 Dec 2023 09:42:12 +0100 Subject: [PATCH 1/7] docs(Readme): github guidelines --- README.md | 78 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 115dcf4..b99afdc 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,9 @@ Develop your [Slack app using Bolt](https://slack.dev/bolt-js/tutorial/getting-s ``This is an alpha version, no grarranty for productive mode!`` -# Usage +## Usage - -## Setup Slack App +### Setup Slack App - open [Slack](https://api.slack.com/apps?new_app=1) - [create new Slack App](https://api.slack.com/apps?new_app=1) @@ -30,11 +29,18 @@ Develop your [Slack app using Bolt](https://slack.dev/bolt-js/tutorial/getting-s - Paste into YAML section - create app -Follow the Node-RED Slack App Configuration. +> [!TIP] +> Don't forget to install the app also into a channel. + +> [!NOTE] +> Could be that the installation of your slack app takes longer than 60min. + + +Follow the Node-RED Slack App Configuration.
Slack Manifest -``` +```yaml display_information: name: Node-Red-Integration description: Integrate Slack with Node-Red instance @@ -80,24 +86,25 @@ settings:
-## Node-RED Installation +### Node-RED Installation -open your folder via favourite shell +open your folder via favourite shell
`npm i @headless-architecture/node-red-contrib-slack-bolt` -## Node-Red Configuration +### Node-Red Configuration -After sucessfull installation of `@headless-architecture/node-red-contrib-slack-bolt` search in your Node-RED toolbar for `slack` +After the installation of `@headless-architecture/node-red-contrib-slack-bolt` search in your Node-RED toolbar for `slack` ![Slack Bolt Nodes](https://raw.githubusercontent.com/fishme/node-red-contrib-slack-bolt/main/docs/img/node-red-slackbolt-nodes.png) -### Nodes +#### Nodes + - message: send text and block messages - registry: registration of slack actions, events, commands, messages, options, shortcuts and views -**Slack App Configuration** +#### Slack App Configuration ![Slack App Configuration](https://raw.githubusercontent.com/fishme/node-red-contrib-slack-bolt/main/docs/img/slack-app-config.png) @@ -109,7 +116,8 @@ After sucessfull installation of `@headless-architecture/node-red-contrib-slack- | Port | default is 3000 [more info](https://slack.dev/bolt-js/concepts#socket-mode) | | App Token | Basic information -> App-level-Token -> create new -> choose connections:write [slack app](https://api.slack.com/apps/) | -**Message** +#### Message + With this node, Node-RED is able to send direct messages into a channel. Private message to a person is not possible (yet). ![Slack Message](https://raw.githubusercontent.com/fishme/node-red-contrib-slack-bolt/main/docs/img/message-config.png) @@ -126,7 +134,7 @@ With this node, Node-RED is able to send direct messages into a channel. Private
Block Example Simple Block for choosing a date -``` +```json [ { "type": "section", @@ -185,7 +193,7 @@ Slack will answer you with a button and if your press on the button the action w ![Active Communication](https://raw.githubusercontent.com/fishme/node-red-contrib-slack-bolt/main/docs/img/node-registry-example1.png) -``` +```javascript // use the object to initialize your handlers. // if you don't need all, clean it. @@ -247,58 +255,56 @@ msg.SlackBolt.events.push( ``` +## Node-Red Example - - -# Node-Red Example copy paste into your see `/examples/example.json` -
Example -[Slack Bolt Integration](https://flows.nodered.org/flow/368f36cbacfeba00b253086438f9a74d) -
+https://flows.nodered.org/flow/368f36cbacfeba00b253086438f9a74d +

-# Development +## Development + +### Installation -## Installation 1. clone this repo `git clone git@github.com:fishme/node-red-contrib-slack-bolt.git` 2. This project is designed to work with `yarn`. If you don't have `yarn` installed, you can install it with `npm install -g yarn`. 3. Install dependencies: `yarn install`. -## Dependencies +### Dependencies Node version >= 18.0.0 -## Developing Nodes +### Developing Nodes Build & Test in Watch mode: -``` +```shell yarn dev ``` -## Building Node Set +### Building Node Set Create a production build: -``` +```shell yarn build ``` -## Testing Node Set in Node-RED +### Testing Node Set in Node-RED [Read Node-RED docs](https://nodered.org/docs/creating-nodes/first-node#testing-your-node-in-node-red) on how to install the node set into your Node-RED runtime. -## Common Errors +### Common Errors -`Error: An API error occurred: channel_not_found` +`Error: An API error occurred: channel_not_found`
**Solution:** Your Slack App is not installed in the channel. -`Error: An API error occurred: invalid_auth` +`Error: An API error occurred: invalid_auth`
**Solution:** Token are wrong. -## Contact +### Contact **Issues:** [https://github.com/fishme/node-red-contrib-slack-bolt/issues](https://github.com/fishme/node-red-contrib-slack-bolt/issues)
**Project Link:** [https://github.com/fishme/node-red-contrib-slack-bolt](https://github.com/fishme/node-red-contrib-slack-bolt)
@@ -306,12 +312,10 @@ yarn build **LinkedIn:** [Go in touch with me](https://www.linkedin.com/in/david-hohl/) -## License +### License MIT © David Hohl +### Thank you -## Thank you - -Alexk111 https://github.com/alexk111/node-red-node-typescript-starter.git for providing the Node-Red Typescript starter - +Alexk111 for providing the Node-Red [Typescript starter](https://github.com/alexk111/node-red-node-typescript-starter.git). From 295641f7b352b0ca3d1cfb52122bf50ee0b0856b Mon Sep 17 00:00:00 2001 From: David Hohl Date: Thu, 21 Dec 2023 09:52:08 +0100 Subject: [PATCH 2/7] docs(Readme): guidelines --- README.md | 60 +++++++++++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index b99afdc..8d35c9b 100644 --- a/README.md +++ b/README.md @@ -2,20 +2,21 @@ Control your Slack App via Node-Red! Slack Bolt integration. -What you can do with this node? +What you can do with this node-red plugin? - send simple text messages - send complex block messages -- events: You can listen to any [Slack Events](https://api.slack.com/events) -- actions: You can listen to user action and respond via Node-Red -- commands: Create your own commands with your Slack App and listen via Node-Red -- shortcuts: Create your own global or message based shortcuts and develop it with Node-Red +- events: listen to any [Slack Events](https://api.slack.com/events) +- actions: listen to user action and respond via Node-Red +- commands: create your own commands with your Slack App and listen via Node-Red +- shortcuts: create your own global or message based shortcuts and develop it with Node-Red - views: Slack views -- messages: Listing for messages in a channel +- messages: listing for messages in a channel Develop your [Slack app using Bolt](https://slack.dev/bolt-js/tutorial/getting-started) for JavaScript with Node-Red. -``This is an alpha version, no grarranty for productive mode!`` +> [!IMPORTANT] +> This is an alpha version, no grarranty for productive mode! ## Usage @@ -31,13 +32,9 @@ Develop your [Slack app using Bolt](https://slack.dev/bolt-js/tutorial/getting-s > [!TIP] > Don't forget to install the app also into a channel. - > [!NOTE] > Could be that the installation of your slack app takes longer than 60min. - -Follow the Node-RED Slack App Configuration. -
Slack Manifest ```yaml @@ -94,7 +91,6 @@ open your folder via favourite shell
### Node-Red Configuration - After the installation of `@headless-architecture/node-red-contrib-slack-bolt` search in your Node-RED toolbar for `slack` ![Slack Bolt Nodes](https://raw.githubusercontent.com/fishme/node-red-contrib-slack-bolt/main/docs/img/node-red-slackbolt-nodes.png) @@ -154,12 +150,13 @@ Simple Block for choosing a date } ] ``` +
- - [Block Kit Builder](https://app.slack.com/block-kit-builder) - - [Formating Blocks](https://api.slack.com/reference/surfaces/formatting#rich-layouts) +- [Block Kit Builder](https://app.slack.com/block-kit-builder) +- [Formating Blocks](https://api.slack.com/reference/surfaces/formatting#rich-layouts) -**Registry** +#### Registry This node enalbe the following Slack functions. @@ -180,23 +177,20 @@ All listener needs to add once. Therefor create a Infection with:
Connect a function node with the following code. - Magic Slack Code. This will listen for App mention in your channel.
-e.g. Your App name @Node-Red-demo-app +e.g. Your App name @Node-Red-demo-app. -``` -// write in your slack channel -@Node-Red-demo-app What's up? -``` -Slack will answer you with a button and if your press on the button the action will be exected with a short answer back. +Write in your Slack channel: +`@Node-Red-demo-app What's up?` + +Slack will answer you with a button and if your press on the button the action will send an answer back. ![Active Communication](https://raw.githubusercontent.com/fishme/node-red-contrib-slack-bolt/main/docs/img/node-registry-example1.png) ```javascript -// use the object to initialize your handlers. -// if you don't need all, clean it. +// initialize your handlers. msg.SlackBolt = { actions: [], commands: [], @@ -258,12 +252,20 @@ msg.SlackBolt.events.push( ## Node-Red Example copy paste into your -see `/examples/example.json` +see [Examples](https://github.com/fishme/node-red-contrib-slack-bolt/blob/main/examples/example.json) https://flows.nodered.org/flow/368f36cbacfeba00b253086438f9a74d

+## Common Errors + +`Error: An API error occurred: channel_not_found`
+**Solution:** Your Slack App is not installed in the channel. + +`Error: An API error occurred: invalid_auth`
+**Solution:** Token are wrong. + ## Development ### Installation @@ -296,14 +298,6 @@ yarn build [Read Node-RED docs](https://nodered.org/docs/creating-nodes/first-node#testing-your-node-in-node-red) on how to install the node set into your Node-RED runtime. -### Common Errors - -`Error: An API error occurred: channel_not_found`
-**Solution:** Your Slack App is not installed in the channel. - -`Error: An API error occurred: invalid_auth`
-**Solution:** Token are wrong. - ### Contact **Issues:** [https://github.com/fishme/node-red-contrib-slack-bolt/issues](https://github.com/fishme/node-red-contrib-slack-bolt/issues)
From 86b0d6bb45a3bd77260e83aa5345b5c7de0f57dd Mon Sep 17 00:00:00 2001 From: David Hohl Date: Thu, 21 Dec 2023 09:53:11 +0100 Subject: [PATCH 3/7] fix(Readme): github guidelines --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8d35c9b..7507c87 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ Develop your [Slack app using Bolt](https://slack.dev/bolt-js/tutorial/getting-s > [!TIP] > Don't forget to install the app also into a channel. + > [!NOTE] > Could be that the installation of your slack app takes longer than 60min. From 8923d2bc9e88f0ff75f920bb70517f0d6a38ba12 Mon Sep 17 00:00:00 2001 From: David Hohl Date: Thu, 21 Dec 2023 10:00:42 +0100 Subject: [PATCH 4/7] chore(version): 1.1.3 docs(Readme): small changes --- README.md | 14 ++++++++++---- package.json | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7507c87..b7d2201 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Control your Slack App via Node-Red! Slack Bolt integration. -What you can do with this node-red plugin? +What you can do with this [node-red](https://flows.nodered.org/node/@headless-architecture/node-red-contrib-slack-bolt) plugin? - send simple text messages - send complex block messages @@ -15,6 +15,10 @@ What you can do with this node-red plugin? Develop your [Slack app using Bolt](https://slack.dev/bolt-js/tutorial/getting-started) for JavaScript with Node-Red. +```shell +npm i @headless-architecture/node-red-contrib-slack-bolt` +``` + > [!IMPORTANT] > This is an alpha version, no grarranty for productive mode! @@ -26,7 +30,7 @@ Develop your [Slack app using Bolt](https://slack.dev/bolt-js/tutorial/getting-s - [create new Slack App](https://api.slack.com/apps?new_app=1) - Choose "from an app manifest" - Choose your workspace -- Copy from /docs/Slack/manifest.yml or manifest below +- Copy from [here](https://github.com/fishme/node-red-contrib-slack-bolt/blob/main/docs/Slack/manifest.yml) or manifest below - Paste into YAML section - create app @@ -88,7 +92,9 @@ settings: open your folder via favourite shell
-`npm i @headless-architecture/node-red-contrib-slack-bolt` +```shell +npm i @headless-architecture/node-red-contrib-slack-bolt` +``` ### Node-Red Configuration @@ -252,7 +258,7 @@ msg.SlackBolt.events.push( ## Node-Red Example -copy paste into your +Import into your project. see [Examples](https://github.com/fishme/node-red-contrib-slack-bolt/blob/main/examples/example.json) https://flows.nodered.org/flow/368f36cbacfeba00b253086438f9a74d diff --git a/package.json b/package.json index 51cdf24..1d0b0f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@headless-architecture/node-red-contrib-slack-bolt", - "version": "1.1.2", + "version": "1.1.3", "description": "Control your Slack App via Node-Red! Slack Bolt integration.", "keywords": [ "Slack", From 07e8ec622e66e7b1da0acae7e3080071d66309fd Mon Sep 17 00:00:00 2001 From: David Hohl Date: Thu, 21 Dec 2023 10:04:47 +0100 Subject: [PATCH 5/7] docs(Readme): small changes --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b7d2201..ea7a3e1 100644 --- a/README.md +++ b/README.md @@ -26,13 +26,14 @@ npm i @headless-architecture/node-red-contrib-slack-bolt` ### Setup Slack App -- open [Slack](https://api.slack.com/apps?new_app=1) +- open [Slack App](https://api.slack.com/apps?new_app=1) - [create new Slack App](https://api.slack.com/apps?new_app=1) -- Choose "from an app manifest" +- Choose `from an app manifest` - Choose your workspace - Copy from [here](https://github.com/fishme/node-red-contrib-slack-bolt/blob/main/docs/Slack/manifest.yml) or manifest below - Paste into YAML section - create app +- optional: If you need the app for events, then you will need a App-Level Token (see under Basic Information) select scope `connection:write` > [!TIP] > Don't forget to install the app also into a channel. From 3b8d9bbc183763cb32e3da6a208fe43eb0fffdea Mon Sep 17 00:00:00 2001 From: David Hohl Date: Thu, 21 Dec 2023 10:07:53 +0100 Subject: [PATCH 6/7] docs(Readme): small changes --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index ea7a3e1..764c202 100644 --- a/README.md +++ b/README.md @@ -288,6 +288,12 @@ Node version >= 18.0.0 ### Developing Nodes +Link your project into your local Node-Red instance. +```shell +cd /path-to-node-red/.node-red +npm install ./path-to-this-project +``` + Build & Test in Watch mode: ```shell From 0441e1fdced103e7dd69bab923c27545af73fbcf Mon Sep 17 00:00:00 2001 From: David Hohl Date: Thu, 21 Dec 2023 10:45:47 +0100 Subject: [PATCH 7/7] docs(Readme): typos chors(version): 1.1.4 --- README.md | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 764c202..9d50335 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ What you can do with this [node-red](https://flows.nodered.org/node/@headless-ar Develop your [Slack app using Bolt](https://slack.dev/bolt-js/tutorial/getting-started) for JavaScript with Node-Red. ```shell -npm i @headless-architecture/node-red-contrib-slack-bolt` +npm i @headless-architecture/node-red-contrib-slack-bolt ``` > [!IMPORTANT] @@ -94,7 +94,7 @@ settings: open your folder via favourite shell
```shell -npm i @headless-architecture/node-red-contrib-slack-bolt` +npm i @headless-architecture/node-red-contrib-slack-bolt ``` ### Node-Red Configuration diff --git a/package.json b/package.json index 1d0b0f5..1dd3d71 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@headless-architecture/node-red-contrib-slack-bolt", - "version": "1.1.3", + "version": "1.1.4", "description": "Control your Slack App via Node-Red! Slack Bolt integration.", "keywords": [ "Slack",