slack-ruby-client 3.2.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +0 -0
  3. data/.github/FUNDING.yml +0 -0
  4. data/.github/dependabot.yml +0 -0
  5. data/.github/prompts/changelog-entries.prompt.yml +32 -0
  6. data/.github/workflows/danger-comment.yml +11 -2
  7. data/.github/workflows/danger.yml +10 -2
  8. data/.github/workflows/lint.yml +21 -6
  9. data/.github/workflows/release.yml +27 -0
  10. data/.github/workflows/test.yml +0 -0
  11. data/.github/workflows/update_api.yml +86 -6
  12. data/.gitignore +1 -0
  13. data/.gitmodules +0 -0
  14. data/.rspec +0 -0
  15. data/.rubocop.yml +94 -1
  16. data/.rubocop_todo.yml +13 -2
  17. data/.ruby-version +0 -0
  18. data/.spellcheck.txt +256 -0
  19. data/AGENTS.md +12 -0
  20. data/CHANGELOG.md +50 -0
  21. data/CONTRIBUTING.md +59 -59
  22. data/Dangerfile +0 -0
  23. data/Gemfile +33 -5
  24. data/LICENSE.md +1 -1
  25. data/README.md +139 -104
  26. data/RELEASING.md +20 -58
  27. data/Rakefile +29 -3
  28. data/SECURITY.md +1 -1
  29. data/UPGRADING.md +48 -40
  30. data/benchmarks/events.rb +26 -0
  31. data/benchmarks/formatting.rb +17 -0
  32. data/benchmarks/support.rb +67 -0
  33. data/benchmarks/web_client.rb +28 -0
  34. data/bin/commands/admin_analytics.rb +0 -0
  35. data/bin/commands/admin_analytics_members.rb +39 -0
  36. data/bin/commands/admin_analytics_messages.rb +4 -4
  37. data/bin/commands/admin_analytics_slackbot.rb +33 -0
  38. data/bin/commands/admin_apps.rb +0 -0
  39. data/bin/commands/admin_apps_activities.rb +0 -0
  40. data/bin/commands/admin_apps_approved.rb +0 -0
  41. data/bin/commands/admin_apps_config.rb +0 -0
  42. data/bin/commands/admin_apps_mcp_servers.rb +21 -0
  43. data/bin/commands/admin_apps_mcp_servers_permissions.rb +33 -0
  44. data/bin/commands/admin_apps_permissions.rb +58 -0
  45. data/bin/commands/admin_apps_requests.rb +0 -0
  46. data/bin/commands/admin_apps_restricted.rb +0 -0
  47. data/bin/commands/admin_audit_anomaly_allow.rb +0 -0
  48. data/bin/commands/admin_auth_policy.rb +0 -0
  49. data/bin/commands/admin_barriers.rb +0 -0
  50. data/bin/commands/admin_conversations.rb +23 -3
  51. data/bin/commands/admin_conversations_ekm.rb +0 -0
  52. data/bin/commands/admin_conversations_restrictAccess.rb +0 -0
  53. data/bin/commands/admin_emoji.rb +0 -0
  54. data/bin/commands/admin_functions.rb +1 -1
  55. data/bin/commands/admin_functions_permissions.rb +0 -0
  56. data/bin/commands/admin_inviteRequests.rb +0 -0
  57. data/bin/commands/admin_inviteRequests_approved.rb +0 -0
  58. data/bin/commands/admin_inviteRequests_denied.rb +0 -0
  59. data/bin/commands/admin_roles.rb +0 -0
  60. data/bin/commands/admin_slackbot_skills.rb +56 -0
  61. data/bin/commands/admin_teams.rb +0 -0
  62. data/bin/commands/admin_teams_admins.rb +0 -0
  63. data/bin/commands/admin_teams_owners.rb +0 -0
  64. data/bin/commands/admin_teams_settings.rb +0 -0
  65. data/bin/commands/admin_usergroups.rb +74 -0
  66. data/bin/commands/admin_users.rb +11 -2
  67. data/bin/commands/admin_users_access.rb +31 -0
  68. data/bin/commands/admin_users_session.rb +0 -1
  69. data/bin/commands/admin_users_unsupportedVersions.rb +0 -0
  70. data/bin/commands/admin_workflows.rb +0 -0
  71. data/bin/commands/admin_workflows_collaborators.rb +0 -0
  72. data/bin/commands/admin_workflows_permissions.rb +0 -0
  73. data/bin/commands/admin_workflows_triggers_types_permissions.rb +0 -0
  74. data/bin/commands/agents_conversations.rb +122 -0
  75. data/bin/commands/agents_sessions.rb +38 -0
  76. data/bin/commands/api.rb +0 -0
  77. data/bin/commands/apps.rb +0 -0
  78. data/bin/commands/apps_activities.rb +0 -0
  79. data/bin/commands/apps_auth_external.rb +0 -0
  80. data/bin/commands/apps_connections.rb +0 -0
  81. data/bin/commands/apps_datastore.rb +0 -0
  82. data/bin/commands/apps_event_authorizations.rb +0 -0
  83. data/bin/commands/apps_icon.rb +0 -0
  84. data/bin/commands/apps_managed_permissions.rb +21 -0
  85. data/bin/commands/apps_manifest.rb +0 -0
  86. data/bin/commands/apps_user_connection.rb +0 -0
  87. data/bin/commands/assistant_search.rb +0 -0
  88. data/bin/commands/assistant_threads.rb +1 -1
  89. data/bin/commands/auth.rb +0 -0
  90. data/bin/commands/auth_teams.rb +0 -0
  91. data/bin/commands/blocks.rb +0 -0
  92. data/bin/commands/bookmarks.rb +0 -0
  93. data/bin/commands/bots.rb +0 -0
  94. data/bin/commands/calls.rb +0 -0
  95. data/bin/commands/calls_participants.rb +0 -0
  96. data/bin/commands/canvases.rb +12 -2
  97. data/bin/commands/canvases_access.rb +0 -0
  98. data/bin/commands/canvases_sections.rb +0 -0
  99. data/bin/commands/chat.rb +10 -7
  100. data/bin/commands/chat_scheduledMessages.rb +0 -0
  101. data/bin/commands/conversations.rb +1 -1
  102. data/bin/commands/conversations_canvases.rb +1 -1
  103. data/bin/commands/conversations_externalInvitePermissions.rb +0 -0
  104. data/bin/commands/conversations_requestSharedInvite.rb +0 -0
  105. data/bin/commands/dialog.rb +0 -0
  106. data/bin/commands/dnd.rb +0 -0
  107. data/bin/commands/emoji.rb +0 -0
  108. data/bin/commands/entity.rb +27 -0
  109. data/bin/commands/files.rb +3 -0
  110. data/bin/commands/files_comments.rb +0 -0
  111. data/bin/commands/files_remote.rb +0 -0
  112. data/bin/commands/functions.rb +0 -0
  113. data/bin/commands/functions_distributions_permissions.rb +0 -0
  114. data/bin/commands/functions_workflows_steps.rb +0 -0
  115. data/bin/commands/functions_workflows_steps_responses.rb +0 -0
  116. data/bin/commands/migration.rb +0 -0
  117. data/bin/commands/oauth.rb +0 -0
  118. data/bin/commands/oauth_v2.rb +21 -0
  119. data/bin/commands/oauth_v2_user.rb +0 -0
  120. data/bin/commands/openid_connect.rb +0 -0
  121. data/bin/commands/pins.rb +1 -1
  122. data/bin/commands/reactions.rb +0 -0
  123. data/bin/commands/reminders.rb +0 -0
  124. data/bin/commands/rtm.rb +0 -0
  125. data/bin/commands/search.rb +0 -0
  126. data/bin/commands/slackLists.rb +0 -0
  127. data/bin/commands/slackLists_access.rb +0 -0
  128. data/bin/commands/slackLists_download.rb +7 -0
  129. data/bin/commands/slackLists_items.rb +2 -1
  130. data/bin/commands/slackbot_skills.rb +71 -0
  131. data/bin/commands/slackbot_skills_library.rb +29 -0
  132. data/bin/commands/stars.rb +0 -0
  133. data/bin/commands/team.rb +1 -0
  134. data/bin/commands/team_billing.rb +0 -0
  135. data/bin/commands/team_externalTeams.rb +1 -1
  136. data/bin/commands/team_preferences.rb +0 -0
  137. data/bin/commands/team_profile.rb +0 -0
  138. data/bin/commands/tooling_tokens.rb +0 -0
  139. data/bin/commands/usergroups.rb +0 -0
  140. data/bin/commands/usergroups_users.rb +0 -0
  141. data/bin/commands/users.rb +1 -0
  142. data/bin/commands/users_admin.rb +0 -0
  143. data/bin/commands/users_discoverableContacts.rb +0 -0
  144. data/bin/commands/users_prefs.rb +0 -0
  145. data/bin/commands/users_profile.rb +0 -0
  146. data/bin/commands/views.rb +0 -0
  147. data/bin/commands/workflows_featured.rb +0 -0
  148. data/bin/commands/workflows_triggers_permissions.rb +0 -0
  149. data/bin/slack +5 -1
  150. data/examples/files_upload_v2/.env.example +0 -0
  151. data/examples/files_upload_v2/Gemfile +0 -0
  152. data/examples/files_upload_v2/README.md +4 -3
  153. data/examples/files_upload_v2/files_upload_v2.rb +1 -1
  154. data/examples/hi_web/Gemfile +0 -0
  155. data/examples/hi_web/hi.gif +0 -0
  156. data/examples/hi_web/hi.rb +1 -1
  157. data/examples/new_ticket/Gemfile +0 -0
  158. data/examples/new_ticket/new_ticket.rb +1 -1
  159. data/examples/oauth_v2/.env.example +0 -0
  160. data/examples/oauth_v2/Gemfile +0 -0
  161. data/examples/oauth_v2/README.md +5 -4
  162. data/examples/oauth_v2/oauth_v2.rb +6 -6
  163. data/lib/slack/config.rb +0 -0
  164. data/lib/slack/events/config.rb +1 -1
  165. data/lib/slack/events/request.rb +2 -2
  166. data/lib/slack/logger.rb +0 -0
  167. data/lib/slack/messages/formatting.rb +29 -20
  168. data/lib/slack/messages/message.rb +0 -0
  169. data/lib/slack/utils/security.rb +0 -0
  170. data/lib/slack/version.rb +1 -1
  171. data/lib/slack/web/api/endpoints/admin_analytics.rb +0 -0
  172. data/lib/slack/web/api/endpoints/admin_analytics_members.rb +66 -0
  173. data/lib/slack/web/api/endpoints/admin_analytics_messages.rb +3 -3
  174. data/lib/slack/web/api/endpoints/admin_analytics_slackbot.rb +54 -0
  175. data/lib/slack/web/api/endpoints/admin_apps.rb +0 -0
  176. data/lib/slack/web/api/endpoints/admin_apps_activities.rb +0 -0
  177. data/lib/slack/web/api/endpoints/admin_apps_approved.rb +0 -0
  178. data/lib/slack/web/api/endpoints/admin_apps_config.rb +0 -0
  179. data/lib/slack/web/api/endpoints/admin_apps_mcp_servers.rb +31 -0
  180. data/lib/slack/web/api/endpoints/admin_apps_mcp_servers_permissions.rb +46 -0
  181. data/lib/slack/web/api/endpoints/admin_apps_permissions.rb +83 -0
  182. data/lib/slack/web/api/endpoints/admin_apps_requests.rb +0 -0
  183. data/lib/slack/web/api/endpoints/admin_apps_restricted.rb +0 -0
  184. data/lib/slack/web/api/endpoints/admin_audit_anomaly_allow.rb +0 -0
  185. data/lib/slack/web/api/endpoints/admin_auth_policy.rb +0 -0
  186. data/lib/slack/web/api/endpoints/admin_barriers.rb +0 -0
  187. data/lib/slack/web/api/endpoints/admin_conversations.rb +32 -2
  188. data/lib/slack/web/api/endpoints/admin_conversations_ekm.rb +0 -0
  189. data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +0 -0
  190. data/lib/slack/web/api/endpoints/admin_emoji.rb +0 -1
  191. data/lib/slack/web/api/endpoints/admin_functions.rb +1 -1
  192. data/lib/slack/web/api/endpoints/admin_functions_permissions.rb +0 -0
  193. data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +0 -0
  194. data/lib/slack/web/api/endpoints/admin_inviteRequests_approved.rb +0 -0
  195. data/lib/slack/web/api/endpoints/admin_inviteRequests_denied.rb +0 -0
  196. data/lib/slack/web/api/endpoints/admin_roles.rb +0 -0
  197. data/lib/slack/web/api/endpoints/admin_slackbot_skills.rb +84 -0
  198. data/lib/slack/web/api/endpoints/admin_teams.rb +0 -0
  199. data/lib/slack/web/api/endpoints/admin_teams_admins.rb +0 -0
  200. data/lib/slack/web/api/endpoints/admin_teams_owners.rb +0 -0
  201. data/lib/slack/web/api/endpoints/admin_teams_settings.rb +0 -0
  202. data/lib/slack/web/api/endpoints/admin_usergroups.rb +111 -0
  203. data/lib/slack/web/api/endpoints/admin_users.rb +14 -1
  204. data/lib/slack/web/api/endpoints/admin_users_access.rb +40 -0
  205. data/lib/slack/web/api/endpoints/admin_users_session.rb +0 -2
  206. data/lib/slack/web/api/endpoints/admin_users_unsupportedVersions.rb +0 -0
  207. data/lib/slack/web/api/endpoints/admin_workflows.rb +0 -0
  208. data/lib/slack/web/api/endpoints/admin_workflows_collaborators.rb +0 -0
  209. data/lib/slack/web/api/endpoints/admin_workflows_permissions.rb +0 -0
  210. data/lib/slack/web/api/endpoints/admin_workflows_triggers_types_permissions.rb +0 -0
  211. data/lib/slack/web/api/endpoints/agents_conversations.rb +186 -0
  212. data/lib/slack/web/api/endpoints/agents_sessions.rb +54 -0
  213. data/lib/slack/web/api/endpoints/api.rb +0 -0
  214. data/lib/slack/web/api/endpoints/apps.rb +0 -0
  215. data/lib/slack/web/api/endpoints/apps_activities.rb +0 -0
  216. data/lib/slack/web/api/endpoints/apps_auth_external.rb +0 -0
  217. data/lib/slack/web/api/endpoints/apps_connections.rb +0 -0
  218. data/lib/slack/web/api/endpoints/apps_datastore.rb +0 -0
  219. data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +0 -0
  220. data/lib/slack/web/api/endpoints/apps_icon.rb +0 -0
  221. data/lib/slack/web/api/endpoints/apps_managed_permissions.rb +27 -0
  222. data/lib/slack/web/api/endpoints/apps_manifest.rb +0 -0
  223. data/lib/slack/web/api/endpoints/apps_user_connection.rb +0 -0
  224. data/lib/slack/web/api/endpoints/assistant_search.rb +0 -0
  225. data/lib/slack/web/api/endpoints/assistant_threads.rb +1 -1
  226. data/lib/slack/web/api/endpoints/auth.rb +0 -0
  227. data/lib/slack/web/api/endpoints/auth_teams.rb +0 -0
  228. data/lib/slack/web/api/endpoints/blocks.rb +0 -0
  229. data/lib/slack/web/api/endpoints/bookmarks.rb +0 -0
  230. data/lib/slack/web/api/endpoints/bots.rb +0 -0
  231. data/lib/slack/web/api/endpoints/calls.rb +0 -0
  232. data/lib/slack/web/api/endpoints/calls_participants.rb +0 -0
  233. data/lib/slack/web/api/endpoints/canvases.rb +16 -2
  234. data/lib/slack/web/api/endpoints/canvases_access.rb +0 -0
  235. data/lib/slack/web/api/endpoints/canvases_sections.rb +0 -0
  236. data/lib/slack/web/api/endpoints/chat.rb +14 -10
  237. data/lib/slack/web/api/endpoints/chat_scheduledMessages.rb +0 -0
  238. data/lib/slack/web/api/endpoints/conversations.rb +1 -1
  239. data/lib/slack/web/api/endpoints/conversations_canvases.rb +1 -1
  240. data/lib/slack/web/api/endpoints/conversations_externalInvitePermissions.rb +0 -0
  241. data/lib/slack/web/api/endpoints/conversations_requestSharedInvite.rb +0 -0
  242. data/lib/slack/web/api/endpoints/dialog.rb +0 -0
  243. data/lib/slack/web/api/endpoints/dnd.rb +0 -0
  244. data/lib/slack/web/api/endpoints/emoji.rb +0 -0
  245. data/lib/slack/web/api/endpoints/entity.rb +48 -0
  246. data/lib/slack/web/api/endpoints/files.rb +7 -0
  247. data/lib/slack/web/api/endpoints/files_comments.rb +0 -0
  248. data/lib/slack/web/api/endpoints/files_remote.rb +0 -0
  249. data/lib/slack/web/api/endpoints/functions.rb +0 -0
  250. data/lib/slack/web/api/endpoints/functions_distributions_permissions.rb +0 -0
  251. data/lib/slack/web/api/endpoints/functions_workflows_steps.rb +0 -0
  252. data/lib/slack/web/api/endpoints/functions_workflows_steps_responses.rb +0 -0
  253. data/lib/slack/web/api/endpoints/migration.rb +0 -0
  254. data/lib/slack/web/api/endpoints/oauth.rb +0 -0
  255. data/lib/slack/web/api/endpoints/oauth_v2.rb +33 -0
  256. data/lib/slack/web/api/endpoints/oauth_v2_user.rb +0 -0
  257. data/lib/slack/web/api/endpoints/openid_connect.rb +0 -0
  258. data/lib/slack/web/api/endpoints/pins.rb +1 -1
  259. data/lib/slack/web/api/endpoints/reactions.rb +0 -0
  260. data/lib/slack/web/api/endpoints/reminders.rb +0 -0
  261. data/lib/slack/web/api/endpoints/rtm.rb +0 -0
  262. data/lib/slack/web/api/endpoints/search.rb +0 -0
  263. data/lib/slack/web/api/endpoints/slackLists.rb +0 -0
  264. data/lib/slack/web/api/endpoints/slackLists_access.rb +0 -0
  265. data/lib/slack/web/api/endpoints/slackLists_download.rb +14 -0
  266. data/lib/slack/web/api/endpoints/slackLists_items.rb +3 -1
  267. data/lib/slack/web/api/endpoints/slackbot_skills.rb +107 -0
  268. data/lib/slack/web/api/endpoints/slackbot_skills_library.rb +36 -0
  269. data/lib/slack/web/api/endpoints/stars.rb +0 -0
  270. data/lib/slack/web/api/endpoints/team.rb +2 -0
  271. data/lib/slack/web/api/endpoints/team_billing.rb +0 -0
  272. data/lib/slack/web/api/endpoints/team_externalTeams.rb +1 -1
  273. data/lib/slack/web/api/endpoints/team_preferences.rb +0 -0
  274. data/lib/slack/web/api/endpoints/team_profile.rb +0 -0
  275. data/lib/slack/web/api/endpoints/tooling_tokens.rb +0 -0
  276. data/lib/slack/web/api/endpoints/usergroups.rb +0 -0
  277. data/lib/slack/web/api/endpoints/usergroups_users.rb +0 -0
  278. data/lib/slack/web/api/endpoints/users.rb +2 -1
  279. data/lib/slack/web/api/endpoints/users_admin.rb +0 -0
  280. data/lib/slack/web/api/endpoints/users_discoverableContacts.rb +0 -0
  281. data/lib/slack/web/api/endpoints/users_prefs.rb +0 -0
  282. data/lib/slack/web/api/endpoints/users_profile.rb +0 -0
  283. data/lib/slack/web/api/endpoints/views.rb +0 -0
  284. data/lib/slack/web/api/endpoints/workflows_featured.rb +0 -0
  285. data/lib/slack/web/api/endpoints/workflows_triggers_permissions.rb +0 -0
  286. data/lib/slack/web/api/endpoints.rb +24 -0
  287. data/lib/slack/web/api/error.rb +0 -0
  288. data/lib/slack/web/api/errors/server_error.rb +1 -1
  289. data/lib/slack/web/api/errors/slack_error.rb +1 -1
  290. data/lib/slack/web/api/errors/too_many_requests_error.rb +1 -1
  291. data/lib/slack/web/api/errors.rb +384 -10
  292. data/lib/slack/web/api/helpers/files.rb +2 -2
  293. data/lib/slack/web/api/helpers.rb +0 -0
  294. data/lib/slack/web/api/mixins/conversations.id.rb +2 -1
  295. data/lib/slack/web/api/mixins/ids.id.rb +2 -1
  296. data/lib/slack/web/api/mixins/users.id.json +0 -0
  297. data/lib/slack/web/api/mixins/users.id.rb +2 -1
  298. data/lib/slack/web/api/mixins/users.search.json +0 -0
  299. data/lib/slack/web/api/mixins/users.search.rb +1 -1
  300. data/lib/slack/web/api/mixins.rb +0 -0
  301. data/lib/slack/web/api/options.rb +0 -0
  302. data/lib/slack/web/api/patches/.gitkeep +0 -0
  303. data/lib/slack/web/api/patches/files.default-filename.patch +12 -0
  304. data/lib/slack/web/api/schema/group.json +0 -0
  305. data/lib/slack/web/api/schema/method.json +0 -0
  306. data/lib/slack/web/api/templates/command.erb +0 -0
  307. data/lib/slack/web/api/templates/endpoints.erb +0 -0
  308. data/lib/slack/web/api/templates/errors.erb +0 -0
  309. data/lib/slack/web/api/templates/method.erb +0 -0
  310. data/lib/slack/web/api/templates/method_spec.erb +0 -0
  311. data/lib/slack/web/client.rb +29 -0
  312. data/lib/slack/web/config.rb +0 -0
  313. data/lib/slack/web/faraday/connection.rb +0 -0
  314. data/lib/slack/web/faraday/options.rb +0 -0
  315. data/lib/slack/web/faraday/request.rb +22 -2
  316. data/lib/slack/web/faraday/response/raise_error.rb +0 -0
  317. data/lib/slack/web/faraday/response/wrap_error.rb +0 -0
  318. data/lib/slack/web/pagination/cursor.rb +0 -0
  319. data/lib/slack-ruby-client.rb +0 -0
  320. data/lib/slack.rb +0 -0
  321. data/lib/slack_ruby_client.rb +0 -0
  322. data/lib/tasks/git.rake +0 -0
  323. data/lib/tasks/update.rake +0 -0
  324. data/lib/tasks/web.rake +0 -0
  325. data/script/release.rb +33 -0
  326. data/slack-ruby-client.gemspec +1 -3
  327. data/slack.png +0 -0
  328. metadata +41 -17
data/README.md CHANGED
@@ -1,13 +1,10 @@
1
- Slack Ruby Client
2
- =================
1
+ # Slack Ruby Client
3
2
 
4
- [![Gem Version](https://badge.fury.io/rb/slack-ruby-client.svg)](http://badge.fury.io/rb/slack-ruby-client)
5
- [![Tests](https://github.com/slack-ruby/slack-ruby-client/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/slack-ruby/slack-ruby-client/actions/workflows/test.yml)
6
- [![Coverage Status](https://coveralls.io/repos/github/slack-ruby/slack-ruby-client/badge.svg?branch=master)](https://coveralls.io/github/slack-ruby/slack-ruby-client?branch=master)
3
+ [![Gem Version](https://badge.fury.io/rb/slack-ruby-client.svg)](http://badge.fury.io/rb/slack-ruby-client) [![Tests](https://github.com/slack-ruby/slack-ruby-client/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/slack-ruby/slack-ruby-client/actions/workflows/test.yml) [![Coverage Status](https://coveralls.io/repos/github/slack-ruby/slack-ruby-client/badge.svg?branch=master)](https://coveralls.io/github/slack-ruby/slack-ruby-client?branch=master)
7
4
 
8
- A Ruby client for the Slack [Web](https://api.slack.com/web) and [Events](https://api.slack.com/events-api) APIs. Comes with a handy command-line client, too. If you are not familiar with these concepts, you might want to watch [this video](http://code.dblock.org/2016/03/11/your-first-slack-bot-service-video.html).
5
+ A Ruby client for the Slack [Web](https://docs.slack.dev/apis/web-api/) and [Events](https://docs.slack.dev/apis/events-api/) APIs. Comes with a handy command-line client, too. If you are not familiar with these concepts, you might want to watch [this video](http://code.dblock.org/2016/03/11/your-first-slack-bot-service-video.html).
9
6
 
10
- ![](slack.png)
7
+ ![Slack Ruby Client](slack.png)
11
8
 
12
9
  # Table of Contents
13
10
 
@@ -64,19 +61,19 @@ A Ruby client for the Slack [Web](https://api.slack.com/web) and [Events](https:
64
61
 
65
62
  ## Useful to Me?
66
63
 
67
- * This library lets you send messages to Slack via the Web API and facilitates integration with the Events API.
68
- * To write a complete bot for Slack you need more than this library, and it's much easier to start with [slack-ruby-bot-server-events](https://github.com/slack-ruby/slack-ruby-bot-server-events).
69
- * To respond to slash commands, interactive components, or events at the lowest level, implement a web application using your favorite web framework, and use this library to call the Slack Web API, and to verify that events are coming from Slack.
64
+ - This library lets you send messages to Slack via the Web API and facilitates integration with the Events API.
65
+ - To write a complete bot for Slack you need more than this library, and it's much easier to start with [slack-ruby-bot-server-events](https://github.com/slack-ruby/slack-ruby-bot-server-events).
66
+ - To respond to slash commands, interactive components, or events at the lowest level, implement a web application using your favorite web framework, and use this library to call the Slack Web API, and to verify that events are coming from Slack.
70
67
 
71
68
  ## Stable Release
72
69
 
73
- You're reading the documentation for the **stable** release of slack-ruby-client, 3.2.0. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
70
+ You're reading the documentation for the **stable** release of slack-ruby-client, 3.4.0. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
74
71
 
75
72
  ## Installation
76
73
 
77
74
  Add to Gemfile.
78
75
 
79
- ```
76
+ ```ruby
80
77
  gem 'slack-ruby-client'
81
78
  ```
82
79
 
@@ -90,28 +87,28 @@ To integrate your bot with Slack, you must first create a new [Slack App](https:
90
87
 
91
88
  ### OAuth Code Grant
92
89
 
93
- Once created, go to the app's Basic Info tab and grab the Client ID and Client Secret. You'll need these in order complete an [OAuth Workflow](https://api.slack.com/authentication/oauth-v2). A working sample that starts a local web server and obtains a bot or a user token for your app using OAuth v2 is available in [examples/oauth_v2](examples/oauth_v2).
90
+ Once created, go to the app's Basic Info tab and grab the Client ID and Client Secret. You'll need these in order to complete an [OAuth workflow](https://docs.slack.dev/authentication/installing-with-oauth/). A working sample that starts a local web server and obtains a bot or a user token for your app using OAuth v2 is available in [examples/oauth_v2](examples/oauth_v2).
94
91
 
95
92
  ### Using an API Token
96
93
 
97
- Although OAuth is recommended, you can also [generate an API token](https://api.slack.com/tutorials/tracks/getting-a-token) for your app and use it for some interactions.
94
+ Although OAuth is recommended, you can also [generate an API token](https://docs.slack.dev/authentication/tokens/) for your app and use it for some interactions.
98
95
 
99
96
  ```ruby
100
97
  Slack.configure do |config|
101
- config.token = ENV['SLACK_API_TOKEN']
98
+ config.token = ENV.fetch('SLACK_API_TOKEN', nil)
102
99
  end
103
100
  ```
104
101
 
105
- This sets a global default token. You can also pass a token into the initializer of both `Slack::Web::Client` and `Slack::RealTime::Client` or configure those separately via `Slack::Web::Config.configure` and `Slack::RealTime::Config.configure`. The instance token will be used over the client type token over the global default.
102
+ This sets a global default token. You can also pass a token into the `Slack::Web::Client` initializer or configure Web clients separately via `Slack::Web::Config.configure`. An instance token takes precedence over the Web client token, which takes precedence over the global default.
106
103
 
107
104
  ### Global Settings
108
105
 
109
106
  The following global settings are supported via `Slack.configure`.
110
107
 
111
- setting | description
112
- -------------|-------------------------------------------------------------------------------------------------
113
- token | Slack API token.
114
- logger | An optional logger, defaults to `::Logger.new(STDOUT)` at `Logger::WARN` level.
108
+ setting | description
109
+ ------------- | -------------------------------------------------------------------------------------------------
110
+ token | Slack API token.
111
+ logger | An optional logger, defaults to `::Logger.new(STDOUT)` at `Logger::WARN` level.
115
112
 
116
113
  ### Web Client
117
114
 
@@ -130,7 +127,7 @@ client.auth_test
130
127
 
131
128
  ##### Send Messages
132
129
 
133
- Send messages with [chat_PostMessage](https://api.slack.com/methods/chat.postMessage).
130
+ Send messages with [chat_postMessage](https://docs.slack.dev/reference/methods/chat.postMessage/).
134
131
 
135
132
  ```ruby
136
133
  client.chat_postMessage(channel: '#general', text: 'Hello World', as_user: true)
@@ -138,11 +135,11 @@ client.chat_postMessage(channel: '#general', text: 'Hello World', as_user: true)
138
135
 
139
136
  See a fully working example in [examples/hi_web](examples/hi_web/hi.rb).
140
137
 
141
- ![](examples/hi_web/hi.gif)
138
+ ![Sending a message with the hi_web example](examples/hi_web/hi.gif)
142
139
 
143
140
  ##### List Channels
144
141
 
145
- List channels with [conversations_list](https://api.slack.com/methods/conversations.list).
142
+ List channels with [conversations_list](https://docs.slack.dev/reference/methods/conversations.list/).
146
143
 
147
144
  ```ruby
148
145
  channels = client.conversations_list.channels
@@ -152,7 +149,7 @@ general_channel = channels.detect { |c| c.name == 'general' }
152
149
 
153
150
  ##### Upload a File
154
151
 
155
- Upload files with [sequenced API calls](https://api.slack.com/messaging/files#uploading_files).
152
+ Upload files with [sequenced API calls](https://docs.slack.dev/messaging/working-with-files/).
156
153
 
157
154
  This library provides a helper method `files_upload_v2` that wraps the three separate API calls.
158
155
 
@@ -165,7 +162,7 @@ client.files_upload_v2(
165
162
  content: File.read('/users/me/results.pdf'), # the string contents of the file
166
163
 
167
164
  # optional options
168
- channels: ['C000000', 'C000001'], # channel IDs to share the file in (:channel_id, :channel, or :channels are all supported)
165
+ channels: %w[C000000 C000001], # channel IDs to share the file in (:channel_id, :channel, or :channels are all supported)
169
166
  initial_comment: 'Sharing the Q1 results :tada:', # the message that is included with the file share thread
170
167
  snippet_type: 'text', # the type of snippet
171
168
  title: 'Q1 Results', # sets the title of the file, overriding the filename
@@ -186,24 +183,13 @@ client.files_upload_v2(
186
183
  )
187
184
  ```
188
185
 
189
- You can use a channel ID passed as `channel_id`, a single channel as `channel`, an array of channel IDs as `channels`, or a channel name or names (prefixed with `#`) in `files_upload_v2`. Lookup by name is not supported by the Slack API and this method called invokes `conversations_list` in order to locate the channel ID. This invocation can have a cost if you have many Slack channels and is only recommended when you intend to list channels anyway.
186
+ You can use a channel ID passed as `channel_id`, a single channel as `channel`, an array of channel IDs as `channels`, or a channel name or names (prefixed with `#`) in `files_upload_v2`. Lookup by name is not supported by the Slack API, so this method invokes `conversations_list` to locate the channel ID. This invocation can have a cost if you have many Slack channels and is only recommended when you intend to list channels anyway.
190
187
 
191
- Note: This library includes a `files_upload` method that uses a deprecated endpoint `files.upload` that will [no longer be supported on 3/11/2025](https://api.slack.com/methods/files.upload#markdown).
192
-
193
- ```ruby
194
- client.files_upload(
195
- channels: '#general',
196
- as_user: true,
197
- file: Faraday::Multipart::FilePart.new('/path/to/avatar.jpg', 'image/jpeg'),
198
- title: 'My Avatar',
199
- filename: 'avatar.jpg',
200
- initial_comment: 'Attached a selfie.'
201
- )
202
- ```
188
+ Note: The generated `files_upload` method calls the [`files.upload`](https://docs.slack.dev/reference/methods/files.upload/) endpoint, which Slack sunset on November 12, 2025. Use `files_upload_v2` instead.
203
189
 
204
190
  ##### Get Channel Info
205
191
 
206
- You can use a channel ID or name (prefixed with `#`) in all functions that take a `:channel` argument. Lookup by name is not supported by the Slack API and the `channels_id` method called invokes `conversations_list` in order to locate the channel ID. This invocation can have a cost if you have many Slack channels. In this scenario, we encourage you to use channel id.
192
+ You can use a channel ID or name (prefixed with `#`) in all functions that take a `:channel` argument. Lookup by name is not supported by the Slack API, so the `channels_id` method invokes `conversations_list` to locate the channel ID. This invocation can have a cost if you have many Slack channels. In this scenario, we encourage you to use channel IDs.
207
193
 
208
194
  ```ruby
209
195
  client.conversations_info(channel: 'C04KB5X4D') # calls conversations_info
@@ -215,7 +201,7 @@ client.conversations_info(channel: '#general') # calls conversations_list follow
215
201
 
216
202
  ##### Get User Info
217
203
 
218
- You can use a user ID or name (prefixed with `@`) in all functions that take a `:user` argument. Lookup by name is not supported by the Slack API and the `users_id` method called invokes `users_list` in order to locate the user ID.
204
+ You can use a user ID or name (prefixed with `@`) in all functions that take a `:user` argument. Lookup by name is not supported by the Slack API, so the `users_id` method invokes `users_list` to locate the user ID.
219
205
 
220
206
  ```ruby
221
207
  client.users_info(user: 'U092BDCLV') # calls users_info
@@ -235,25 +221,25 @@ client.users_search(user: 'dblock')
235
221
 
236
222
  ##### Other
237
223
 
238
- Refer to the [Slack Web API Method Reference](https://api.slack.com/methods) for the list of all available functions.
224
+ Refer to the [Slack Web API method reference](https://docs.slack.dev/reference/methods/) for the list of all available functions.
239
225
 
240
226
  #### JSON Arguments
241
227
 
242
- The Web API expects certain arguments to be sent as JSON-encoded strings. With the client you can pass these args as ruby hashes or arrays and they will be converted automatically to JSON, or you can provide the JSON directly.
228
+ The Web API expects certain arguments to be sent as JSON-encoded strings. With the client you can pass these arguments as Ruby hashes or arrays and they will be converted automatically to JSON, or you can provide the JSON directly.
243
229
 
244
230
  ```ruby
245
- # As ruby objects
231
+ # As Ruby objects
246
232
  client.chat_postMessage(
247
233
  channel: 'C123456',
248
234
  text: 'Hello World',
249
- blocks: [{type: 'section', text: {type: 'mrkdwn', text: 'Hello World'}}]
235
+ blocks: [{ type: 'section', text: { type: 'mrkdwn', text: 'Hello World' } }]
250
236
  )
251
237
 
252
238
  # As a JSON string
253
239
  client.chat_postMessage(
254
240
  channel: 'C123456',
255
241
  text: 'Hello World',
256
- blocks: JSON.dump([{type: 'section', text: {type: 'mrkdwn', text: 'Hello World'}}])
242
+ blocks: JSON.dump([{ type: 'section', text: { type: 'mrkdwn', text: 'Hello World' } }])
257
243
  )
258
244
  client.chat_postMessage(
259
245
  channel: 'C123456',
@@ -278,22 +264,22 @@ client = Slack::Web::Client.new(user_agent: 'Slack Ruby Client/3.0')
278
264
 
279
265
  The following settings are supported.
280
266
 
281
- setting | description
282
- -----------------------------|-------------------------------------------------------------------------------------------------
283
- token | Slack API token.
284
- user_agent | User-agent, defaults to _Slack Ruby Client/version_.
285
- proxy | Optional HTTP proxy.
286
- ca_path | Optional SSL certificates path.
287
- ca_file | Optional SSL certificates file.
288
- endpoint | Slack endpoint, default is _https://slack.com/api_.
289
- logger | Optional `Logger` instance that logs HTTP requests.
290
- timeout | Optional open/read timeout in seconds.
291
- open_timeout | Optional connection open timeout in seconds.
292
- default_page_size | Optional page size for paginated requests, default is _100_.
293
- conversations_id_page_size | Optional page size for conversations_list requests made when calculating conversation id from a conversation name, default is _nil_, which will use the default_page_size.
294
- users_id_page_size | Optional page size for users_list requests made when calculating user id from a user name, default is _nil_, which will use the default_page_size.
295
- default_max_retries | Optional number of retries for paginated requests, default is _100_.
296
- adapter | Optional HTTP adapter to use, defaults to `Faraday.default_adapter`.
267
+ setting | description
268
+ ----------------------------- | -------------------------------------------------------------------------------------------------
269
+ token | Slack API token.
270
+ user_agent | User-agent, defaults to _Slack Ruby Client/version_.
271
+ proxy | Optional HTTP proxy.
272
+ ca_path | Optional SSL certificates path.
273
+ ca_file | Optional SSL certificates file.
274
+ endpoint | Slack endpoint, default is _https://slack.com/api_.
275
+ logger | Optional `Logger` instance that logs HTTP requests.
276
+ timeout | Optional open/read timeout in seconds.
277
+ open_timeout | Optional connection open timeout in seconds.
278
+ default_page_size | Optional page size for paginated requests, default is _100_.
279
+ conversations_id_page_size | Optional page size for conversations_list requests made when calculating conversation id from a conversation name, default is _nil_, which will use the default_page_size.
280
+ users_id_page_size | Optional page size for users_list requests made when calculating user id from a user name, default is _nil_, which will use the default_page_size.
281
+ default_max_retries | Optional number of retries for paginated requests, default is _100_.
282
+ adapter | Optional HTTP adapter to use, defaults to `Faraday.default_adapter`.
297
283
 
298
284
  You can also pass request options, including `timeout` and `open_timeout` into individual calls.
299
285
 
@@ -301,13 +287,48 @@ You can also pass request options, including `timeout` and `open_timeout` into i
301
287
  client.conversations_list(request: { timeout: 180 })
302
288
  ```
303
289
 
304
- You can control what proxy options are used by modifying the `http_proxy` environment variable per [Net::HTTP's documentation](https://docs.ruby-lang.org/en/2.0.0/Net/HTTP.html#class-Net::HTTP-label-Proxies).
290
+ Use `with_request` and `with_response` to create a configured client copy with HTTP callbacks, without changing the original client or parsed-body return values:
291
+
292
+ ```ruby
293
+ scopes = nil
294
+ observed_client = client.with_request do |request|
295
+ request.headers['X-Custom'] = 'value'
296
+ end.with_response do |response|
297
+ scopes = response.headers['x-oauth-scopes']&.split(',')&.map(&:strip)
298
+ end
299
+
300
+ result = observed_client.auth_test
301
+ observed_client.users_list do |page|
302
+ puts page.members
303
+ end
304
+ ```
305
+
306
+ Request callbacks receive a `Faraday::Request` after authentication and request options are configured, before dispatch. They can change headers, body, and options. Response callbacks receive a `Faraday::Response` with the parsed body, headers, and status after successful completion; they do not run when Slack or transport errors are raised. Callbacks apply to each HTTP call, including pagination pages and requests made by helpers. Endpoint blocks retain their existing meaning.
307
+
308
+ Chaining registers callbacks in order. Copies preserve client configuration but use independent connections and callback lists; the original client is unchanged. Callback exceptions propagate and request callback failures prevent dispatch. Callbacks are synchronous; avoid storing sensitive authorization headers, and synchronize any shared state if using a client concurrently.
309
+
310
+ Use `with_error` to observe Slack and transport errors without recovering from them:
311
+
312
+ ```ruby
313
+ observed_client = client.with_error do |error|
314
+ logger.warn(
315
+ message: error.message,
316
+ errors: error.respond_to?(:errors) && error.response ? error.errors : nil,
317
+ response_metadata: error.respond_to?(:response_metadata) && error.response ? error.response_metadata : nil
318
+ )
319
+ end
320
+ observed_client.auth_test
321
+ ```
322
+
323
+ Error callbacks receive the exception and then it is re-raised unchanged. They run for every failed HTTP attempt, including failures that pagination subsequently retries. Successful calls and exceptions from request or response callbacks do not trigger them. If an error callback raises, its exception propagates instead and later callbacks are not invoked. As with other callbacks, these methods return a configured copy and can be chained.
305
324
 
306
- Note that Docker on OSX seems to incorrectly set the proxy, causing `Faraday::ConnectionFailed, ERROR -- : Failed to open TCP connection to : (getaddrinfo: Name or service not known)`. You might need to manually unset `http_proxy` in that case, eg. `http_proxy="" bundle exec ruby ./my_bot.rb`.
325
+ You can control what proxy options are used by modifying the `http_proxy` environment variable per the [Net::HTTP documentation](https://docs.ruby-lang.org/en/master/Net/HTTP.html#class-Net::HTTP-label-Proxies).
326
+
327
+ Note that Docker on macOS seems to incorrectly set the proxy, causing `Faraday::ConnectionFailed, ERROR -- : Failed to open TCP connection to : (getaddrinfo: Name or service not known)`. You might need to manually unset `http_proxy` in that case, e.g. `http_proxy="" bundle exec ruby ./my_bot.rb`.
307
328
 
308
329
  #### Pagination Support
309
330
 
310
- The Web client natively supports [cursor pagination](https://api.slack.com/docs/pagination#cursors) for methods that allow it, such as `users_list`. Supply a block and the client will make repeated requests adjusting the value of `cursor` with every response. The default limit is set to 100 and can be adjusted via `Slack::Web::Client.config.default_page_size` or by passing it directly into the API call.
331
+ The Web client natively supports [cursor pagination](https://docs.slack.dev/apis/web-api/pagination/) for methods that allow it, such as `users_list`. Supply a block and the client will make repeated requests adjusting the value of `cursor` with every response. The default limit is set to 100 and can be adjusted via `Slack::Web::Client.config.default_page_size` or by passing it directly into the API call.
311
332
 
312
333
  ```ruby
313
334
  all_members = []
@@ -338,7 +359,7 @@ Note that Slack expects `text` to be UTF-8 encoded. If your messages appear with
338
359
  ```ruby
339
360
  text = 'characters such as "Ñ", "Á", "É"'
340
361
  text.encoding
341
- => #<Encoding:UTF-8>
362
+ # => #<Encoding:UTF-8>
342
363
  client.chat_postMessage(channel: '#general', text: text, as_user: true)
343
364
  # renders 'characters such as "Ñ", "Á", "É"' in Slack
344
365
 
@@ -356,6 +377,8 @@ client.chat_postMessage(channel: '#general', text: text, as_user: true)
356
377
  If Slack returns an error for the request, then an error will be raised. The error class is specific to the type of error that Slack returns. For instance if Slack returns `account_inactive` then the error will be `Slack::Web::Api::Errors::AccountInactive`. This allows you to handle certain types of errors as needed:
357
378
 
358
379
  ```ruby
380
+ begin
381
+ client.auth_test
359
382
  rescue Slack::Web::Api::Errors::AccountInactive => e
360
383
  # deal with inactive account
361
384
  end
@@ -364,6 +387,8 @@ end
364
387
  All of these errors inherit from `Slack::Web::Api::Errors::SlackError`, so you can handle or silence all errors if necessary:
365
388
 
366
389
  ```ruby
390
+ begin
391
+ client.auth_test
367
392
  rescue Slack::Web::Api::Errors::SlackError => e
368
393
  # capture all Slack errors
369
394
  end
@@ -375,19 +400,19 @@ In all of these cases the error message contains the error code, which is also a
375
400
 
376
401
  ##### Rate Limiting
377
402
 
378
- If you exceed [Slack’s rate limits](https://api.slack.com/docs/rate-limits), a `Slack::Web::Api::Errors::TooManyRequestsError` will be raised instead. (This does not inherit from `Slack::Web::Api::Errors::SlackError`.)
403
+ If you exceed [Slack's rate limits](https://docs.slack.dev/apis/web-api/rate-limits/), a `Slack::Web::Api::Errors::TooManyRequestsError` will be raised instead. (This does not inherit from `Slack::Web::Api::Errors::SlackError`.)
379
404
 
380
405
  ##### Other Errors
381
406
 
382
- When Slack is temporarily unavailable a subclass of `Slack::Web::Api::Errors::ServerError` will be raised and the original `Faraday::Error` will be accesible via `exception.cause`. (Starting with 0.18.0 this is no longer a subclass of `Slack::Web::Api::Errors::SlackError`.)
407
+ When Slack is temporarily unavailable a subclass of `Slack::Web::Api::Errors::ServerError` will be raised and the original `Faraday::Error` will be accessible via `exception.cause`. (Starting with 0.18.0 this is no longer a subclass of `Slack::Web::Api::Errors::SlackError`.)
383
408
 
384
- Specifically `Slack::Web::Api::Errors::ParsingError` will be raised on non-json response (i.e. 200 OK with `Slack unavailable` HTML page) and `Slack::Web::Api::Errors::HttpRequestError` subclasses for connection failures (`Slack::Web::Api::Errors::TimeoutError` for read/open timeouts & `Slack::Web::Api::Errors::UnavailableError` for 5xx HTTP responses).
409
+ Specifically `Slack::Web::Api::Errors::ParsingError` will be raised on a non-JSON response (i.e. 200 OK with `Slack unavailable` HTML page) and `Slack::Web::Api::Errors::HttpRequestError` subclasses for connection failures (`Slack::Web::Api::Errors::TimeoutError` for read/open timeouts & `Slack::Web::Api::Errors::UnavailableError` for 5xx HTTP responses).
385
410
 
386
411
  In any other case, a `Faraday::ClientError` will be raised.
387
412
 
388
413
  ### Events API
389
414
 
390
- This library provides limited support for the [Slack Events API](https://api.slack.com/events-api).
415
+ This library provides limited support for the [Slack Events API](https://docs.slack.dev/apis/events-api/).
391
416
 
392
417
  #### Configuring Slack::Events
393
418
 
@@ -401,10 +426,10 @@ end
401
426
 
402
427
  The following settings are supported.
403
428
 
404
- setting | description
405
- ----------------------|---------------------------------------------------------------------------------------------------
406
- signing_secret | Slack signing secret, defaults is `ENV['SLACK_SIGNING_SECRET']`.
407
- signature_expires_in | Signature expiration window in seconds, default is `300`.
429
+ setting | description
430
+ ---------------------- | ---------------------------------------------------------------------------------------------------
431
+ signing_secret | Slack signing secret, default is `ENV['SLACK_SIGNING_SECRET']`.
432
+ signature_expires_in | Signature expiration window in seconds, default is `300`.
408
433
 
409
434
  #### Verifying the Request Signature
410
435
 
@@ -416,6 +441,7 @@ slack_request.verify!
416
441
  ```
417
442
 
418
443
  To specify secrets on a per-request basis:
444
+
419
445
  ```ruby
420
446
  Slack::Events::Request.new(
421
447
  http_request,
@@ -426,9 +452,13 @@ Slack::Events::Request.new(
426
452
 
427
453
  The `verify!` call may raise `Slack::Events::Request::MissingSigningSecret`, `Slack::Events::Request::InvalidSignature` or `Slack::Events::Request::TimestampExpired` errors.
428
454
 
455
+ Both rewindable request bodies and non-rewindable streams permitted by Rack 3 are supported. `Slack::Events::Request#body` caches the raw body. Rewindable inputs are rewound before and after reading, preserving access for other consumers. Non-rewindable inputs are consumed once; use `slack_request.body` for subsequent access to the raw body.
456
+
457
+ Verify the signature before middleware or application code reads a non-rewindable input. Bytes already consumed from a one-shot stream cannot be recovered, and verification will fail. If multiple consumers need to read `rack.input`, install `Rack::RewindableInput::Middleware` (Rack 3) before any body-reading middleware to buffer the input.
458
+
429
459
  ### Message Handling
430
460
 
431
- All text in Slack uses the same [system of formatting and escaping](https://api.slack.com/docs/formatting): chat messages, direct messages, file comments, etc. [Slack::Messages::Formatting](lib/slack/messages/formatting.rb) provides convenience methods to format and parse messages.
461
+ All text in Slack uses the same [system of formatting and escaping](https://docs.slack.dev/messaging/formatting-message-text/): chat messages, direct messages, file comments, etc. [Slack::Messages::Formatting](lib/slack/messages/formatting.rb) provides convenience methods to format and parse messages.
432
462
 
433
463
  #### Formatting Messages
434
464
 
@@ -446,13 +476,13 @@ Slack::Messages::Formatting.date(date)
446
476
  # => "<!date^1688150386^{date_num} {time_secs}|2023-06-30 18:39:46 +0000>"
447
477
 
448
478
  # Specify a different format
449
- # See https://api.slack.com/reference/surfaces/formatting#date-formatting for supported formats
479
+ # See https://docs.slack.dev/messaging/formatting-message-text/ for supported formats
450
480
  Slack::Messages::Formatting.date(date, format: 'date_long_pretty')
451
481
  # => "<!date^1688150386^date_long_pretty|2023-06-30 18:39:46 +0000>"
452
482
 
453
483
  # Link your timestamp to a fully qualified URL
454
- Slack::Messages::Formatting.date(date, link: 'https://media.giphy.com/media/AcfTF7tyikWyroP0x7/giphy.gif')
455
- # => "<!date^1688150386^{date_num} {time_secs}^https://media.giphy.com/media/AcfTF7tyikWyroP0x7/giphy.gif|2023-06-30 18:39:46 +0000>"
484
+ Slack::Messages::Formatting.date(date, link: 'https://example.com/party')
485
+ # => "<!date^1688150386^{date_num} {time_secs}^https://example.com/party|2023-06-30 18:39:46 +0000>"
456
486
 
457
487
  # Specify custom fallback text to use if the client is unable to process the date
458
488
  Slack::Messages::Formatting.date(date, text: 'party time!')
@@ -502,31 +532,30 @@ Slack::Messages::Formatting.url_link(text, url)
502
532
 
503
533
  ##### Markdown Formatting
504
534
 
505
- Slack uses a mishmash of regular markdown formatting with its own syntax. Some features like headings aren't supported and will be left as-is, but others like bold, strikethrough, and links are converted.
535
+ Slack uses a mishmash of regular Markdown formatting with its own syntax. Some features like headings aren't supported and will be left as-is, but others like bold, strikethrough, and links are converted.
506
536
 
507
537
  ```ruby
508
- text = """
509
- ## A heading
510
- **Bold text**
511
- ~~Strikethrough text~~
512
- _Italic text_
513
- [A link](https://example.com)
514
- `code`
515
- """
538
+ text = <<~MARKDOWN
539
+ ## A heading
540
+ **Bold text**
541
+ ~~Strikethrough text~~
542
+ _Italic text_
543
+ [A link](https://example.com)
544
+ `code`
545
+ MARKDOWN
546
+
516
547
  Slack::Messages::Formatting.markdown(text)
517
- # => """
518
- # ## A heading
519
- # *Bold text*
520
- # ~Strikethrough text~
521
- # _Italic text_
522
- # <https://example.com|A link>
523
- # `code`
524
- # """
548
+ # ## A heading
549
+ # *Bold text*
550
+ # ~Strikethrough text~
551
+ # _Italic text_
552
+ # <https://example.com|A link>
553
+ # `code`
525
554
  ```
526
555
 
527
556
  #### Parsing Messages
528
557
 
529
- `Slack::Messages::Formatting` also provides ways to escape or unescape messages. This comes handy, for example, you want to treat all input to a real time bot as plain text.
558
+ `Slack::Messages::Formatting` also provides ways to escape or unescape messages. This comes in handy, for example, when you want to treat all input to a bot as plain text.
530
559
 
531
560
  ##### Unescaping Message Content
532
561
 
@@ -562,18 +591,24 @@ Slack::Messages::Formatting.escape('Hello & <world>')
562
591
 
563
592
  ### Command-Line Client
564
593
 
565
- The slack command-line client returns JSON data from the Slack API.
594
+ The slack command-line client returns JSON data from the Slack API. It uses [GLI](https://github.com/davetron5000/gli), which is not a dependency of slack-ruby-client, so install it alongside the client.
595
+
596
+ ```bash
597
+ gem install gli
598
+ ```
599
+
600
+ Or add `gem 'gli'` to your Gemfile.
566
601
 
567
602
  #### Authenticate with Slack
568
603
 
569
- ```
604
+ ```console
570
605
  $ slack --slack-api-token=[token] auth test
571
606
  {"ok":true,"url":"...","team":"...","user":"...","team_id":"...","user_id":"..."}
572
607
  ```
573
608
 
574
609
  #### Send a Message
575
610
 
576
- ```
611
+ ```console
577
612
  export SLACK_API_TOKEN=...
578
613
  $ slack chat postMessage --text="hello world" --channel="#general"
579
614
  {"ok":true,"channel":"...","ts":"...","message":{"text":"hello world","username":"bot","type":"message","subtype":"bot_message","ts":"..."}}
@@ -581,16 +616,16 @@ $ slack chat postMessage --text="hello world" --channel="#general"
581
616
 
582
617
  #### Get Channel Info
583
618
 
584
- ```
619
+ ```console
585
620
  $ slack conversations info --channel=#general
586
621
  {"ok":true,"channel":{"id":"C04KB5X4D","name":"general", ...}}
587
622
  ```
588
623
 
589
624
  #### List Users
590
625
 
591
- Combine with [jq](http://stedolan.github.io/jq), a command-line JSON parser.
626
+ Combine with [jq](https://jqlang.org/), a command-line JSON processor.
592
627
 
593
- ```
628
+ ```console
594
629
  $ slack users list | jq '.members | map({(.id): .name})'
595
630
  [
596
631
  {
@@ -608,11 +643,11 @@ See `slack help` for a complete command-line reference.
608
643
 
609
644
  This library was created and has been maintained for a decade by [@dblock](https://github.com/dblock). Please consider [a sponsorship](https://github.com/sponsors/dblock).
610
645
 
611
- Enterprise Support is available as part of a Tidelift Subscription. Click [here](https://tidelift.com/subscription/request-a-demo?utm_source=rubygems-slack-ruby-client&utm_medium=referral&utm_campaign=enterprise) for more details.
646
+ Enterprise Support is available as part of a [Tidelift Subscription](https://tidelift.com/subscription/request-a-demo?utm_source=rubygems-slack-ruby-client&utm_medium=referral&utm_campaign=enterprise).
612
647
 
613
648
  ## History
614
649
 
615
- This gem is based on [slack-ruby-gem](https://github.com/aki017/slack-ruby-gem), but it more clearly separates the Web and RTM APIs, is more thoroughly tested and is in active development.
650
+ This gem is based on [slack-ruby-gem](https://github.com/aki017/slack-ruby-gem), but it more clearly separates the Web and Events APIs, is more thoroughly tested, and is in active development. The RealTime (RTM) client was removed in 2.0.0, see [UPGRADING](UPGRADING.md).
616
651
 
617
652
  ## Security
618
653
 
@@ -624,6 +659,6 @@ See [CONTRIBUTING](CONTRIBUTING.md).
624
659
 
625
660
  ## Copyright and License
626
661
 
627
- Copyright (c) 2015-2025, [Daniel Doubrovkine](https://twitter.com/dblockdotorg), [Artsy](https://www.artsy.net) and [Contributors](CHANGELOG.md).
662
+ Copyright (c) 2015-2026, [Daniel Doubrovkine](https://twitter.com/dblockdotorg), [Artsy](https://www.artsy.net) and [Contributors](CHANGELOG.md).
628
663
 
629
664
  This project is licensed under the [MIT License](LICENSE.md).
data/RELEASING.md CHANGED
@@ -1,77 +1,39 @@
1
1
  # Releasing Slack-Ruby-Client
2
2
 
3
- There're no hard rules about when to release slack-ruby-client. Release bug fixes frequently, features not so frequently and breaking API changes rarely.
3
+ There are no hard rules about when to release slack-ruby-client. Release bug fixes frequently, features not so frequently, and breaking API changes rarely.
4
4
 
5
- ### Release
5
+ Releases use [ruby-gem-release](https://github.com/dblock/ruby-gem-release) 0.9.0 through a manually dispatched [Release workflow](.github/workflows/release.yml). Keep the `ruby-gem-release` gem in [Gemfile](Gemfile) and the reusable workflow in `release.yml` pinned to the same version. The workflow publishes through RubyGems Trusted Publishing, so no RubyGems API key or one-time password is needed. It only runs from `master` in `slack-ruby/slack-ruby-client`. The local Bundler `rake release`, `release:rubygem_push`, and `release:source_control_push` tasks are disabled.
6
6
 
7
- Run tests, check that all tests succeed locally.
7
+ ## One-Time Setup
8
8
 
9
- ```
10
- bundle install
11
- rake
12
- ```
13
-
14
- Check that the last build succeeded in [GitHub Actions](https://github.com/slack-ruby/slack-ruby-client/actions) for all supported platforms.
15
-
16
- Change "Next" in [CHANGELOG.md](CHANGELOG.md) to the current date.
17
-
18
- ```
19
- ### 0.2.2 (7/10/2015)
20
- ```
21
-
22
- Remove the line with "Your contribution here.", since there will be no more contributions to this release.
23
-
24
- In the "Stable Release" section of the README, change `**next**` to `**stable**` and add the version number so users know that they are reading the documentation for a released version.
25
-
26
- ```
27
- ## Stable Release
28
-
29
- You're reading the documentation for the **stable** release of slack-ruby-client, 0.2.2. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
30
- ```
31
-
32
- Commit your changes.
33
-
34
- ```
35
- git add README.md CHANGELOG.md
36
- git commit -m "Preparing for release, 0.2.2."
37
- git push origin master
38
- ```
9
+ Before the first automated release, a maintainer must:
39
10
 
40
- Release.
11
+ 1. Create the GitHub environment `release` in `slack-ruby/slack-ruby-client`, for example with `gh api --method PUT repos/slack-ruby/slack-ruby-client/environments/release`, and restrict its deployment branches to `master`. Add required reviewers to require maintainer approval before publication.
12
+ 2. At [slack-ruby-client's trusted publishers](https://rubygems.org/gems/slack-ruby-client/trusted_publishers), add a GitHub Actions publisher with repository owner `slack-ruby`, repository `slack-ruby-client`, workflow filename `release.yml`, environment `release`, and the separate workflow repository owner `dblock` and repository `ruby-gem-release`.
13
+ 3. Allow GitHub Actions to push release commits and `v*` tags to `master`. See the upstream [setup and permissions guidance](https://github.com/dblock/ruby-gem-release/blob/v0.9.0/RELEASING.md#one-time-setup).
41
14
 
42
- ```
43
- $ rake release
15
+ Verify the setup without publishing with a [dry run](https://github.com/dblock/ruby-gem-release/blob/v0.9.0/docs/actions/release.md#dry-run), which never edits files, builds, pushes, or publishes:
44
16
 
45
- slack-ruby-client 0.2.2 built to pkg/slack-ruby-client-0.2.2.gem.
46
- Tagged v0.2.2.
47
- Pushed git commits and tags.
48
- Pushed slack-ruby-client 0.2.2 to rubygems.org.
17
+ ```bash
18
+ gh workflow run release.yml --repo slack-ruby/slack-ruby-client --ref master -f dry-run=true
49
19
  ```
50
20
 
51
- ### Prepare for the Next Version
21
+ ## Prepare
52
22
 
53
- Add the next release to [CHANGELOG.md](CHANGELOG.md).
23
+ Start with a clean, up-to-date `master` and verify that the latest [CI checks](https://github.com/slack-ruby/slack-ruby-client/actions) pass on all supported Ruby versions. Follow semantic versioning: patch for fixes, minor for backward-compatible features, major for breaking changes. Check `VERSION` in [lib/slack/version.rb](lib/slack/version.rb) and the matching `(Next)` heading in [CHANGELOG.md](CHANGELOG.md), and change both in a pull request if needed, or pass a `version` override when dispatching. Document breaking changes in [UPGRADING.md](UPGRADING.md).
54
24
 
55
- ```
56
- ### 0.2.3 (Next)
57
-
58
- * Your contribution here.
59
- ```
25
+ The workflow dates the `(Next)` heading using `YYYY/MM/DD` and removes the `* Your contribution here.` placeholder; a section without notes cannot be released. It also rewrites the "Stable Release" paragraph in [README.md](README.md) to point at the released version, and restores the next-release wording afterwards.
60
26
 
61
- Increment the third version number in [lib/slack/version.rb](lib/slack/version.rb).
27
+ Release automation requires MRI Ruby 3.3 or newer; the release dependency and tasks are skipped on older Ruby versions and JRuby. Release specs in [spec/release](spec/release) run the actual release tasks against a local fixture with the [ruby-gem-release RSpec helpers](https://github.com/dblock/ruby-gem-release/blob/v0.9.0/docs/testing.md), without contacting RubyGems or GitHub.
62
28
 
63
- Undo your change in README about the stable release.
29
+ ## Publish
64
30
 
31
+ ```bash
32
+ gh workflow run release.yml --repo slack-ruby/slack-ruby-client --ref master
65
33
  ```
66
- ## Stable Release
67
34
 
68
- You're reading the documentation for the **next** release of slack-ruby-client. Please see the documentation for the [last stable release, v0.2.2](https://github.com/slack-ruby/slack-ruby-client/blob/v0.2.2/README.md) unless you're integrating with HEAD. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
69
- ```
35
+ Pass `-f version=x.y.z` to release a different version. Dispatching starts a real release; do not merge into `master` while it runs. The workflow prepares the release commit, runs lint and specs on Ruby 3.3, builds the gem, preserves recovery artifacts, publishes to RubyGems, pushes the release commit and `v` tag, and creates a GitHub Release with the changelog notes and the gem attached. It then increments the patch version, adds a new `(Next)` section, and pushes the next development commit. Verify the published version on [RubyGems](https://rubygems.org/gems/slack-ruby-client), the tag, the [GitHub Release](https://github.com/slack-ruby/slack-ruby-client/releases), and the next development commit.
70
36
 
71
- Commit your changes.
37
+ ## Recover a Partial Release
72
38
 
73
- ```
74
- git add README.md CHANGELOG.md lib/slack/version.rb
75
- git commit -m "Preparing for next development iteration, 0.2.3."
76
- git push origin master
77
- ```
39
+ Inspect the failed run, RubyGems, remote commits and tags, and the GitHub Release before retrying. Publication may have succeeded even if a later step failed. Never move a published tag or republish a version with different contents. Use the run's retained recovery artifacts and the upstream [recovery instructions](https://github.com/dblock/ruby-gem-release/blob/v0.9.0/docs/actions/release.md#recovery-artifacts).