Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: slackapi/node-slack-sdk
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: @slack/web-api@7.0.4
Choose a base ref
...
head repository: slackapi/node-slack-sdk
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: @slack/web-api@7.1.0
Choose a head ref

Commits on Apr 30, 2024

  1. socket-mode: Rewrite to Python(ish) Implementation (#1781)

    Closes #1771
    Fil Maj authored Apr 30, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    476e6a9 View commit details
  2. Publish @slack/socket-mode@2.0.0 (#1785)

    Fil Maj authored Apr 30, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    6840250 View commit details

Commits on May 1, 2024

  1. types: Add slack_file object to image block/element types (#1783)

    Co-authored-by: cfeeney5 <c.feeney5@gmail.com>
    Co-authored-by: Fil Maj <maj.fil@gmail.com>
    3 people authored May 1, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    aea11d0 View commit details

Commits on May 14, 2024

  1. feat: providing a way to disable message content being logged (#1786) -

    fixes #1751
    Parama92 authored May 14, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    b98ef1e View commit details

Commits on May 15, 2024

  1. Add CodeCov reporting back after a 3 year hiatus (#1788)

    Fil Maj authored May 15, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    2c0d6e2 View commit details
  2. Add codecov badges to READMEs.

    Filip Maj committed May 15, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    4d45007 View commit details

Commits on May 23, 2024

  1. Add new @slack/cli-test CLI test utility node bindings for use in a…

    …utomated testing purposes (#1789)
    Fil Maj authored May 23, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    0f38f72 View commit details
  2. Publish @slack/cli-test@0.0.1 (#1791)

    Fil Maj authored May 23, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    393177f View commit details
  3. Actually publish @slack/cli-test@0.0.1

    Filip Maj committed May 23, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    793c6a3 View commit details
  4. cli-test: ensure skipping update is truly the default (#1792)

    Fil Maj authored May 23, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    0fedf14 View commit details
  5. cli-test: more async-friendly / event-driven approach to process moni…

    …toring/management (#1793)
    Fil Maj authored May 23, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    9f3af6b View commit details
  6. Publish @slack/cli-test@0.0.2

    Filip Maj committed May 23, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    5efe7f3 View commit details

Commits on May 27, 2024

  1. cli-test: add app list command (#1794)

    Fil Maj authored May 27, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    11cb80e View commit details
  2. cli-test(trace): include test trace constants for 'datastore count' (#…

    zimeg authored May 27, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    c3725a9 View commit details
  3. cli-test: small internal refactor to use new app.list command (#1797)

    Fil Maj authored May 27, 2024
    Copy the full SHA
    9fb278a View commit details
  4. Publish @slack/cli-test@0.1.0 (#1796)

    Fil Maj authored May 27, 2024
    Copy the full SHA
    65b2332 View commit details

Commits on May 28, 2024

  1. cli-test: add ability to invoke arbitrary CLI commands (#1798)

    Fil Maj authored May 28, 2024
    Copy the full SHA
    a0e01c5 View commit details

Commits on May 29, 2024

  1. cli-test: expose --slackdev flag as qa option to all commands (#1799)

    Fil Maj authored May 29, 2024
    Copy the full SHA
    1938408 View commit details

Commits on May 31, 2024

  1. web-api(docs): prefer filesUploadV2 for uploading files (#1802)

    zimeg authored May 31, 2024
    Copy the full SHA
    eca4d68 View commit details
  2. web-api(docs): fix the sunset year for the files.upload method (#1805)

    zimeg authored May 31, 2024
    Copy the full SHA
    cf80469 View commit details

Commits on Jun 3, 2024

  1. cli-test: adding shell and app.list APIs, exposing QA environment…

    … flags, added more traces available in CLI v2.25.0 (#1804)
    Fil Maj authored Jun 3, 2024
    Copy the full SHA
    17ef7ae View commit details
  2. docs: the cli test package version should include a build metadata an…

    …d not a pre-release suffix.
    Filip Maj committed Jun 3, 2024
    Copy the full SHA
    efb2aaf View commit details
  3. Publish @slack/cli-test@0.2.0+cli.2.25.0 (#1806)

    Fil Maj authored Jun 3, 2024
    Copy the full SHA
    b195311 View commit details

Commits on Jun 5, 2024

  1. Publish @slack/types@2.12.0 (#1808)

    Fil Maj authored Jun 5, 2024
    Copy the full SHA
    bb21de9 View commit details

Commits on Jun 10, 2024

  1. chore: replace master branch refs with main (#1810)

    davidlj95 authored Jun 10, 2024
    Copy the full SHA
    31f27db View commit details
  2. chore: update Github Actions badges syntax (#1811)

    davidlj95 authored Jun 10, 2024
    Copy the full SHA
    e7232b2 View commit details
  3. docs: update Typescript minimum version: v7 + link (#1812)

    davidlj95 authored Jun 10, 2024
    Copy the full SHA
    a771044 View commit details
  4. feat: allow using WebClient APIs without argument (#1809)

    davidlj95 authored Jun 10, 2024
    Copy the full SHA
    9f2935f View commit details

Commits on Jun 12, 2024

  1. web-api: public canvas APIs (#1813)

    Fil Maj authored Jun 12, 2024
    Copy the full SHA
    a2c0fe5 View commit details
  2. Public @slack/web-api@7.1.0 (#1814)

    Fil Maj authored Jun 12, 2024
    Copy the full SHA
    1583183 View commit details
Showing with 4,119 additions and 1,514 deletions.
  1. +1 −1 .github/contributing.md
  2. +1 −1 .github/issue_template.md
  3. +2 −0 .github/maintainers_guide.md
  4. +1 −1 .github/pull_request_template.md
  5. +24 −10 .github/workflows/ci-build.yml
  6. +1 −1 README.md
  7. +28 −0 codecov.yml
  8. +1 −1 docs/_layouts/default.html
  9. +1 −1 docs/_main/about.md
  10. +3 −1 docs/_main/typescript.md
  11. +4 −230 docs/_packages/socket_mode.md
  12. +114 −60 docs/_packages/web_api.md
  13. +2 −2 docs/_packages/webhook.md
  14. +1 −1 examples/greet-and-react/index.js
  15. +0 −15 lerna.json
  16. +7 −15 lint-configs/.eslintrc.js
  17. +2 −0 packages/cli-hooks/README.md
  18. +2 −1 packages/cli-hooks/package.json
  19. +7 −0 packages/cli-test/.c8rc.json
  20. +1 −0 packages/cli-test/.eslintignore
  21. +15 −0 packages/cli-test/.eslintrc.js
  22. +7 −0 packages/cli-test/.gitignore
  23. +3 −0 packages/cli-test/.mocharc.json
  24. +23 −0 packages/cli-test/LICENSE
  25. +74 −0 packages/cli-test/README.md
  26. +59 −0 packages/cli-test/package.json
  27. +88 −0 packages/cli-test/src/cli/cli-process.spec.ts
  28. +115 −0 packages/cli-test/src/cli/cli-process.ts
  29. +26 −0 packages/cli-test/src/cli/command-error.ts
  30. +79 −0 packages/cli-test/src/cli/commands/app.ts
  31. +110 −0 packages/cli-test/src/cli/commands/auth.ts
  32. +82 −0 packages/cli-test/src/cli/commands/collaborator.ts
  33. +64 −0 packages/cli-test/src/cli/commands/create.ts
  34. +84 −0 packages/cli-test/src/cli/commands/env.ts
  35. +37 −0 packages/cli-test/src/cli/commands/external-auth.ts
  36. +36 −0 packages/cli-test/src/cli/commands/function.ts
  37. +28 −0 packages/cli-test/src/cli/commands/manifest.ts
  38. +220 −0 packages/cli-test/src/cli/commands/platform.ts
  39. +183 −0 packages/cli-test/src/cli/commands/trigger.ts
  40. +41 −0 packages/cli-test/src/cli/index.spec.ts
  41. +108 −0 packages/cli-test/src/cli/index.ts
  42. +93 −0 packages/cli-test/src/cli/shell.spec.ts
  43. +222 −0 packages/cli-test/src/cli/shell.ts
  44. +20 −0 packages/cli-test/src/index.spec.ts
  45. +9 −0 packages/cli-test/src/index.ts
  46. +69 −0 packages/cli-test/src/utils/constants.ts
  47. +50 −0 packages/cli-test/src/utils/custom-errors.ts
  48. +24 −0 packages/cli-test/src/utils/logger.ts
  49. +29 −0 packages/cli-test/src/utils/types.ts
  50. +1 −0 packages/cli-test/tsconfig.eslint.json
  51. +28 −0 packages/cli-test/tsconfig.json
  52. +7 −0 packages/logger/.c8rc.json
  53. +0 −1 packages/logger/.gitignore
  54. +0 −14 packages/logger/.nycrc.json
  55. +2 −0 packages/logger/README.md
  56. +4 −4 packages/logger/package.json
  57. +7 −0 packages/oauth/.c8rc.json
  58. +1 −3 packages/oauth/.gitignore
  59. +0 −14 packages/oauth/.nycrc.json
  60. +2 −0 packages/oauth/README.md
  61. +5 −4 packages/oauth/package.json
  62. +7 −0 packages/socket-mode/.c8rc.json
  63. +2 −1 packages/socket-mode/.mocharc.json
  64. +0 −14 packages/socket-mode/.nycrc.json
  65. +15 −30 packages/socket-mode/README.md
  66. +10 −8 packages/socket-mode/package.json
  67. +29 −0 packages/socket-mode/src/SlackWebSocket.spec.ts
  68. +269 −0 packages/socket-mode/src/SlackWebSocket.ts
  69. +0 −258 packages/socket-mode/src/SocketModeClient.spec.js
  70. +284 −0 packages/socket-mode/src/SocketModeClient.spec.ts
  71. +212 −597 packages/socket-mode/src/SocketModeClient.ts
  72. +37 −3 packages/socket-mode/src/SocketModeOptions.ts
  73. +18 −19 packages/socket-mode/src/logger.ts
  74. +81 −4 packages/socket-mode/test/integration.spec.js
  75. +2 −6 packages/socket-mode/tsconfig.json
  76. +1 −1 packages/types/package.json
  77. +124 −34 packages/types/src/block-kit/block-elements.ts
  78. +8 −7 packages/types/src/block-kit/blocks.ts
  79. +42 −0 packages/types/src/block-kit/composition-objects.ts
  80. +7 −0 packages/web-api/.c8rc.json
  81. +0 −14 packages/web-api/.nycrc.json
  82. +2 −0 packages/web-api/README.md
  83. +5 −5 packages/web-api/package.json
  84. +49 −1 packages/web-api/src/WebClient.spec.js
  85. +16 −2 packages/web-api/src/WebClient.ts
  86. +5 −2 packages/web-api/src/errors.ts
  87. +58 −0 packages/web-api/src/methods.ts
  88. +2 −0 packages/web-api/src/types/helpers.ts
  89. +4 −3 packages/web-api/src/types/request/admin/apps.ts
  90. +2 −1 packages/web-api/src/types/request/admin/barriers.ts
  91. +7 −6 packages/web-api/src/types/request/admin/conversations.ts
  92. +2 −1 packages/web-api/src/types/request/admin/emoji.ts
  93. +4 −3 packages/web-api/src/types/request/admin/roles.ts
  94. +2 −1 packages/web-api/src/types/request/admin/teams.ts
  95. +6 −3 packages/web-api/src/types/request/admin/users.ts
  96. +4 −3 packages/web-api/src/types/request/admin/workflows.ts
  97. +4 −2 packages/web-api/src/types/request/api.ts
  98. +2 −1 packages/web-api/src/types/request/apps.ts
  99. +6 −5 packages/web-api/src/types/request/auth.ts
  100. +3 −2 packages/web-api/src/types/request/bots.ts
  101. +91 −0 packages/web-api/src/types/request/canvas.ts
  102. +3 −2 packages/web-api/src/types/request/chat.ts
  103. +6 −4 packages/web-api/src/types/request/conversations.ts
  104. +5 −4 packages/web-api/src/types/request/dnd.ts
  105. +3 −2 packages/web-api/src/types/request/emoji.ts
  106. +1 −0 packages/web-api/src/types/request/index.ts
  107. +2 −2 packages/web-api/src/types/request/openid.ts
  108. +4 −3 packages/web-api/src/types/request/reactions.ts
  109. +2 −1 packages/web-api/src/types/request/reminders.ts
  110. +5 −4 packages/web-api/src/types/request/rtm.ts
  111. +16 −14 packages/web-api/src/types/request/team.ts
  112. +5 −2 packages/web-api/src/types/request/usergroups.ts
  113. +21 −0 packages/web-api/src/types/response/CanvasesAccessDeleteResponse.ts
  114. +21 −0 packages/web-api/src/types/response/CanvasesAccessSetResponse.ts
  115. +22 −0 packages/web-api/src/types/response/CanvasesCreateResponse.ts
  116. +19 −0 packages/web-api/src/types/response/CanvasesDeleteResponse.ts
  117. +20 −0 packages/web-api/src/types/response/CanvasesEditResponse.ts
  118. +24 −0 packages/web-api/src/types/response/CanvasesSectionsLookupResponse.ts
  119. +22 −0 packages/web-api/src/types/response/ConversationsCanvasesCreateResponse.ts
  120. +7 −0 packages/web-api/src/types/response/index.ts
  121. +1 −1 packages/web-api/test/types/methods/admin.apps.test-d.ts
  122. +1 −1 packages/web-api/test/types/methods/admin.barriers.test-d.ts
  123. +2 −2 packages/web-api/test/types/methods/admin.conversations.test-d.ts
  124. +1 −1 packages/web-api/test/types/methods/admin.emoji.test-d.ts
  125. +1 −1 packages/web-api/test/types/methods/admin.roles.test-d.ts
  126. +1 −1 packages/web-api/test/types/methods/admin.teams.test-d.ts
  127. +2 −2 packages/web-api/test/types/methods/admin.users.test-d.ts
  128. +1 −1 packages/web-api/test/types/methods/admin.workflows.test-d.ts
  129. +2 −2 packages/web-api/test/types/methods/api.test-d.ts
  130. +1 −1 packages/web-api/test/types/methods/apps.test-d.ts
  131. +4 −4 packages/web-api/test/types/methods/auth.test-d.ts
  132. +2 −2 packages/web-api/test/types/methods/bots.test-d.ts
  133. +172 −0 packages/web-api/test/types/methods/canvas.test-d.ts
  134. +1 −1 packages/web-api/test/types/methods/chat.test-d.ts
  135. +2 −2 packages/web-api/test/types/methods/conversations.test-d.ts
  136. +3 −3 packages/web-api/test/types/methods/dnd.test-d.ts
  137. +2 −2 packages/web-api/test/types/methods/emoji.test-d.ts
  138. +1 −1 packages/web-api/test/types/methods/openid.test-d.ts
  139. +1 −1 packages/web-api/test/types/methods/reactions.test-d.ts
  140. +1 −1 packages/web-api/test/types/methods/reminders.test-d.ts
  141. +3 −3 packages/web-api/test/types/methods/rtm.test-d.ts
  142. +13 −7 packages/web-api/test/types/methods/team.test-d.ts
  143. +1 −1 packages/web-api/test/types/methods/usergroups.test-d.ts
  144. +7 −0 packages/webhook/.c8rc.json
  145. +0 −14 packages/webhook/.nycrc.json
  146. +2 −0 packages/webhook/README.md
  147. +3 −3 packages/webhook/package.json
2 changes: 1 addition & 1 deletion .github/contributing.md
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ If the contribution doesn't meet the above criteria, you may fail our automated
3. :herb: Create a new branch and check it out.
4. :crystal_ball: Make your changes and commit them locally. Magic happens here!
5. :arrow_heading_up: Push your new branch to your fork. (e.g. `git push username fix-issue-16`).
6. :inbox_tray: Open a Pull Request on github.com from your new branch on your fork to `master` in this
6. :inbox_tray: Open a Pull Request on github.com from your new branch on your fork to `main` in this
repository.

## Maintainers
2 changes: 1 addition & 1 deletion .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ Describe your issue here.
- [ ] discussion

### Requirements (place an `x` in each of the `[ ]`)
* [ ] I've read and understood the [Contributing guidelines](https://github.com/slackapi/node-slack-sdk/blob/master/.github/contributing.md) and have done my best effort to follow them.
* [ ] I've read and understood the [Contributing guidelines](https://github.com/slackapi/node-slack-sdk/blob/main/.github/contributing.md) and have done my best effort to follow them.
* [ ] I've read and agree to the [Code of Conduct](https://slackhq.github.io/code-of-conduct).
* [ ] I've searched for any related issues and avoided creating a duplicate issue.

2 changes: 2 additions & 0 deletions .github/maintainers_guide.md
Original file line number Diff line number Diff line change
@@ -165,6 +165,8 @@ Releasing can feel intimidating at first, but rest assured: if you make a mistak
### 🔖 Versioning and Tags
This project is versioned using [Semantic Versioning](http://semver.org/), particularly in the [npm flavor](https://docs.npmjs.com/getting-started/semantic-versioning). Each release is tagged using git. The naming convention for tags is `{package_name}@{version}`. For example, the tag `@slack/web-api@v5.0.0` marks the v5.0.0 release of the `@slack/web-api` package. A single commit will have multiple tags when multiple packages are released simultaneously.

One package that expands upon the standard major.minor.patch version schema typically associated with Semantic Versioning is the `@slack/cli-test` package. This package employs standard major.minor.patch version, in addition to a [build metadata suffix](https://semver.org/#spec-item-10) suffix of the form `+cli.X.Y.Z`, e.g. `0.1.0+cli.2.24.0`. The version after `+cli.` communicates compatibility between the `@slack/cli-test` package and the [Slack Platfrom CLI](https://api.slack.com/automation/quickstart) itself.

### 🪵 Branches
`main` is where active development occurs. Long running named feature branches are occasionally created for collaboration on a feature that has a large scope (because everyone cannot push commits to another person's open Pull Request). After a major version increment, a maintenance branch for the older major version is left open (e.g. `v3`, `v4`, etc).

2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -4,5 +4,5 @@ Describe the goal of this PR. Mention any related Issue numbers.

### Requirements (place an `x` in each `[ ]`)

* [ ] I've read and understood the [Contributing Guidelines](https://github.com/slackapi/node-slack-sdk/blob/master/.github/contributing.md) and have done my best effort to follow them.
* [ ] I've read and understood the [Contributing Guidelines](https://github.com/slackapi/node-slack-sdk/blob/main/.github/contributing.md) and have done my best effort to follow them.
* [ ] I've read and agree to the [Code of Conduct](https://slackhq.github.io/code-of-conduct).
34 changes: 24 additions & 10 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -15,14 +15,15 @@ jobs:
matrix:
node-version: [18.x, 20.x]
package:
- packages/cli-hooks
- packages/logger
- packages/oauth
- packages/rtm-api
- packages/socket-mode
- packages/types
- packages/web-api
- packages/webhook
- cli-hooks
- cli-test
- logger
- oauth
- rtm-api
- socket-mode
- types
- web-api
- webhook
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
@@ -32,15 +33,28 @@ jobs:
- name: Get Development Dependencies
run: npm i
- name: Build and Run Tests in Each Package
working-directory: ${{ matrix.package }}
working-directory: packages/${{ matrix.package }}
run: |
npm install || npm list
# depending on which package we are testing, also npm link up other dependent packages
case "$PWD" in
*/webhook) pushd ../types && npm i && popd && npm link ../types;;
*/web-api) pushd ../types && npm i && popd && npm link ../types && pushd ../logger && npm i && popd && npm link ../logger;;
*/oauth) pushd ../logger && npm i && popd && npm link ../logger && pushd ../web-api && npm i && popd && npm link ../web-api;;
# TODO: add socket-mode here once new major version released
*/socket-mode) pushd ../logger && npm i && popd && npm link ../logger && pushd ../web-api && npm i && popd && npm link ../web-api;;
*) ;; # default
esac
npm test
- name: Check for coverage report existence
id: check_coverage
uses: andstor/file-existence-action@v3
with:
files: packages/${{ matrix.package }}/coverage/lcov.info
- name: Upload code coverage
if: matrix.node-version == '20.x' && steps.check_coverage.outputs.files_exists == 'true'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: packages/${{ matrix.package }}/coverage
flags: ${{ matrix.package }}
verbose: true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Node Slack SDK

[![build-ci](https://github.com/slackapi/node-slack-sdk/workflows/Node.js/badge.svg)](https://github.com/slackapi/node-slack-sdk/actions?query=workflow%3A%22Node.js%22)
[![build-ci](https://github.com/slackapi/node-slack-sdk/actions/workflows/ci-build.yml/badge.svg)](https://github.com/slackapi/node-slack-sdk/actions/workflows/ci-build.yml)
<!-- TODO: npm versions with scoped packages: https://github.com/rvagg/nodei.co/issues/24 -->
___

28 changes: 28 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
comment:
layout: "condensed_header, diff, flags"

flags:
cli-hooks:
paths:
- packages/cli-hooks/**
carryforward: true
logger:
paths:
- packages/logger/**
carryforward: true
oauth:
paths:
- packages/oauth/**
carryforward: true
socket-mode:
paths:
- packages/socket-mode/**
carryforward: true
web-api:
paths:
- packages/web-api/**
carryforward: true
webhook:
paths:
- packages/webhook/**
carryforward: true
2 changes: 1 addition & 1 deletion docs/_layouts/default.html
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@

<ul class="sidebar_menu_list footer_nav">
<li><a href="{{ site.code_of_conduct_url }}">Code of Conduct</a></li>
<li><a href="https://github.com/{{ site.github_username }}/{{ site.repo_name }}/blob/master/.github/contributing.md">Contributing</a></li>
<li><a href="https://github.com/{{ site.github_username }}/{{ site.repo_name }}/blob/main/.github/contributing.md">Contributing</a></li>
<li><a href="{{ site.cla_url }}">Contributor License Agreement</a></li>
</ul>

2 changes: 1 addition & 1 deletion docs/_main/about.md
Original file line number Diff line number Diff line change
@@ -8,5 +8,5 @@ hidden: true
{{ site.title }} is proudly maintained with :sparkling_heart: by the Slack Platform team

* [Code of Conduct]({{ site.code_of_conduct_url }})
* [Contributing](https://github.com/{{ site.github_username }}/{{ site.repo_name }}/blob/master/.github/contributing.md)
* [Contributing](https://github.com/{{ site.github_username }}/{{ site.repo_name }}/blob/main/.github/contributing.md)
* [Contributor License Agreement]({{ site.cla_url }})
4 changes: 3 additions & 1 deletion docs/_main/typescript.md
Original file line number Diff line number Diff line change
@@ -12,7 +12,9 @@ This page helps describe how to use this package from a project that also uses T

### Minimum version

The latest major versions of the `@slack/web-api`, `@slack/rtm-api`, and `@slack/webhook` packages (v6.x) are supported to build against the minimum TypeScript version v4.1.0. See also: https://slack.dev/node-slack-sdk/tutorials/migrating-to-v6
Latest major versions of `@slack/web-api`, `@slack/rtm-api`, and `@slack/webhook` packages are supported to build against TypeScript version 5.3.x. You can try to use a greater minor version of Typescript like 5.4 or above, but beware that [API Breaking Changes](https://github.com/microsoft/TypeScript/wiki/API-Breaking-Changes) can be introduced in minor Typescript versions that break compatibility.

The v6 versions of `@slack/web-api`, `@slack/rtm-api`, and `@slack/webhook` packages are supported to build against the minimum TypeScript version v4.1.0. See also [v5 to v6 migration guide](https://slack.dev/node-slack-sdk/tutorials/migrating-to-v6) for more details.

The v5 versions of `@slack/web-api`, `@slack/rtm-api`, and `@slack/webhook` packages are supported to build against TypeScript v3.3.0 or higher. The v4 versions of the `@slack/web-api`, `@slack/rtm-api`, and `@slack/webhook` packages are supported to build against TypeScript v2.7.0 or higher.

234 changes: 4 additions & 230 deletions docs/_packages/socket_mode.md
Original file line number Diff line number Diff line change
@@ -7,133 +7,11 @@ anchor_links_header: Usage

# Slack Socket Mode

For baseline package documentation, please see the project's [`README`](https://github.com/slackapi/node-slack-sdk/tree/main/packages/socket-mode#readme) or the [documentation on npm](https://www.npmjs.com/package/@slack/socket-mode).

## Installation
The following contain additional examples that may be useful for consumers.

```shell
$ npm install @slack/socket-mode
```

---

### Prerequisites

This package requires a Slack app with an **App-level token**.

To create a new Slack app, head over to [api.slack.com/apps/new](https://api.slack.com/apps?new_app=1).

To generate an **App Token** for your app, on your app's page on [api.slack.com/apps](https://api.slack.com/apps), under the main **Basic Information** page, scroll down to **App-Level Tokens**. Click **Generate Token and Scopes**, add a name for your app token, and click **Add Scope**. Choose `connections:write` and then click **Generate**. Copy and safely store the generated token!

### Initialize the client

This package is designed to support [**Socket Mode**](https://api.slack.com/socket-mode), which allows your app to receive events from Slack over a WebSocket connection.

The package exports a `SocketModeClient` class. Your app will create an instance of the class for each workspace it communicates with.

```javascript
const { SocketModeClient } = require('@slack/socket-mode');

// Read a token from the environment variables
const appToken = process.env.SLACK_APP_TOKEN;

// Initialize
const socketModeClient = new SocketModeClient({ appToken });
```

### Connect to Slack

After your client establishes a connection, your app can send data to and receive data from Slack. Connecting is as easy as calling the `.start()` method.

```javascript
const { SocketModeClient } = require('@slack/socket-mode');
const appToken = process.env.SLACK_APP_TOKEN;

const socketModeClient = new SocketModeClient({ appToken });

(async () => {
// Connect to Slack
await socketModeClient.start();
})();
```
---

### Listen for an event

Bolt apps register [listener functions](https://slack.dev/bolt-js/reference#listener-functions), which are triggered when a specific event type is received by the client.

If you've used Node's [`EventEmitter`](https://nodejs.org/api/events.html#events_class_eventemitter) pattern
before, then you're already familiar with how this works, since the client is an `EventEmitter`.

The `event` argument passed to the listener is an object. Its content corresponds to the [type of
event](https://api.slack.com/events) it's registered for.

```javascript
const { SocketModeClient } = require('@slack/socket-mode');
const appToken = process.env.SLACK_APP_TOKEN;

const socketModeClient = new SocketModeClient({ appToken });

// Attach listeners to events by type. See: https://api.slack.com/events/message
socketModeClient.on('message', async ({ event }) => {
console.log(event);
});

(async () => {
await socketModeClient.start();
})();
```

---

### Send a message

To respond to events and send messages back into Slack, we recommend using the `@slack/web-api` package with a `bot token`.

```javascript
const { SocketModeClient } = require('@slack/socket-mode');
const { WebClient } = require('@slack/web-api');

const appToken = process.env.SLACK_APP_TOKEN;
const socketModeClient = new SocketModeClient({ appToken });

const { WebClient } = require('@slack/web-api');
const webClient = new WebClient(process.env.SLACK_BOT_TOKEN);

// Attach listeners to events by type. See: https://api.slack.com/events/message
socketModeClient.on('member_joined_channel', async ({event, body, ack}) => {
try {
// send acknowledgement back to slack over the socketMode websocket connection
// this is so slack knows you have received the event and are processing it
await ack();
await webClient.chat.postMessage({
blocks: [
{
type: 'section',
text: {
type: 'mrkdwn',
text: `Welcome to the channel, <@${event.user}>. We're here to help. Let us know if you have an issue.`,
},
accessory: {
type: 'button',
text: {
type: 'plain_text',
text: 'Get Help',
},
value: 'get_help',
},
},
],
channel: event.channel,
});
} catch (error) {
console.log('An error occurred', error);
}
});
```
---


### Listen for Interactivity Events
## Listen for Interactivity Events

To receive interactivity events such as shorcut invocations, button clicks, and modal data submission, your listener can subscribe to "interactive" events.

@@ -182,108 +60,4 @@ socketModeClient.on('slash_commands', async ({ body, ack }) => {
});
```

When your app has multiple interactive events or slash commands, you will need to include your own routing logic. This is a good time to consider using Slack's Bolt framework, which provides an easier ways to register listeners for events and user actions. You can learn more in [Bolt's Socket Mode documentation](https://slack.dev/bolt-js/concepts#socket-mode).

---

### Lifecycle events

The client's connection to Slack has a lifecycle. This means the client can be seen as a state machine which transitions through a few states as it connects, disconnects, reconnects, and synchronizes with Slack. The client emits an event for each state it transitions to throughout its lifecycle. If your app simply needs to know whether the client is connected or not, the `.connected` boolean property can be checked.

In the table below, the client's states are listed, which are also the names of the events you can use to observe the transition to that state. The table also includes descriptions for the states and arguments that a listener would receive.

| Event Name | Arguments | Description |
|-----------------|-----------------|-------------|
| `connecting` | | The client is in the process of connecting to the platform. |
| `authenticated` | `(connectData)` - the response from `apps.connections.open` | The client has authenticated with the platform. This is a sub-state of `connecting`. |
| `connected` | | The client is connected to the platform and incoming events will start being emitted. |
| `ready` | | The client is ready to send outgoing messages. This is a sub-state of `connected` |
| `disconnecting` | | The client is no longer connected to the platform and cleaning up its resources. It will soon transition to `disconnected`. |
| `reconnecting` | | The client is no longer connected to the platform and cleaning up its resources. It will soon transition to `connecting`. |
| `disconnected` | `(error)` | The client is not connected to the platform. This is a steady state - no attempt to connect is occurring. The `error` argument will be `undefined` when the client initiated the disconnect (normal). |

The client also emits events that are part of its lifecycle, but aren't states. Instead, they represent specific moments that might be helpful to your app. The following table lists these events, their description, and includes the arguments that a listener would receive.

| Event Name | Arguments | Description |
|-----------------|-----------|-------------|
| `error` | `(error)` | An error has occurred. See [error handling](#handle-errors) for details. |
| `slack_event` | `(eventType, event)` | An incoming Slack event has been received. |
| `unable_to_socket_mode_start` | `(error)` | A problem occurred while connecting, a reconnect may or may not occur. |

---

### Logging

The `SocketModeClient` will log interesting information to the console by default. You can use the `logLevel` to decide how much or what kind of information should be output. There are a few possible log levels, which you can find in the `LogLevel` export. By default, the value is set to `LogLevel.INFO`. While you're in development, it's sometimes helpful to set this to the most verbose: `LogLevel.DEBUG`.

```javascript
// Import LogLevel from the package
const { SocketModeClient, LogLevel } = require('@slack/socket-mode');
const appToken = process.env.SLACK_APP_TOKEN;

// Log level is one of the options you can set in the constructor
const socketModeClient = new SocketModeClient({
appToken,
logLevel: LogLevel.DEBUG,
});

(async () => {
await socketModeClient.start();
})();
```

All the log levels, in order of most to least information are: `DEBUG`, `INFO`, `WARN`, and `ERROR`.

<details>
<summary markdown="span">
<strong><i>Sending log output somewhere besides the console</i></strong>
</summary>

You can also choose to have logs sent to a custom logger using the `logger` option. A custom logger needs to implement specific methods (known as the `Logger` interface):

| Method | Parameters | Return type |
|--------------|-------------------|-------------|
| `setLevel()` | `level: LogLevel` | `void` |
| `setName()` | `name: string` | `void` |
| `debug()` | `...msgs: any[]` | `void` |
| `info()` | `...msgs: any[]` | `void` |
| `warn()` | `...msgs: any[]` | `void` |
| `error()` | `...msgs: any[]` | `void` |

A very simple custom logger might ignore the name and level, and write all messages to a file.

```javascript
const { createWriteStream } = require('fs');
const logWritable = createWriteStream('/var/my_log_file'); // Not shown: close this stream

const socketModeClient = new SocketModeClient({
appToken,
// Creating a logger as a literal object. It's more likely that you'd create a class.
logger: {
debug(...msgs): { logWritable.write('debug: ' + JSON.stringify(msgs)); },
info(...msgs): { logWritable.write('info: ' + JSON.stringify(msgs)); },
warn(...msgs): { logWritable.write('warn: ' + JSON.stringify(msgs)); },
error(...msgs): { logWritable.write('error: ' + JSON.stringify(msgs)); },
setLevel(): { },
setName(): { },
},
});

(async () => {
await socketModeClient.start();
})();
```
</details>

---

## Requirements

This package supports Node v14 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.

## Getting Help

If you get stuck, we're here to help. The following are the best ways to get assistance working through your issue:

* [Issue Tracker](http://github.com/slackapi/node-slack-sdk/issues) for questions, feature requests, bug reports and general discussion related to these packages. Try searching before you create a new issue.
When your app has multiple interactive events or slash commands, you will need to include your own routing logic. This is a good time to consider using Slack's Bolt framework, which provides an easier way to register listeners for events and user actions. You can learn more in [Bolt's Socket Mode documentation](https://slack.dev/bolt-js/concepts#socket-mode).
Loading