#slack #client #api-bindings #web-api #sockets

slack-morphism

Slack Morphism is a modern client library for Slack Web/Events API/Socket Mode and Block Kit

98 releases (36 stable)

2.4.0 Jun 28, 2024
2.2.0 Apr 22, 2024
2.1.0 Mar 4, 2024
1.17.0 Jan 14, 2024
0.3.1 Oct 20, 2020

#70 in Web programming

Download history 4016/week @ 2024-04-01 3806/week @ 2024-04-08 5322/week @ 2024-04-15 4786/week @ 2024-04-22 3517/week @ 2024-04-29 3744/week @ 2024-05-06 4123/week @ 2024-05-13 4337/week @ 2024-05-20 4259/week @ 2024-05-27 5066/week @ 2024-06-03 5726/week @ 2024-06-10 6089/week @ 2024-06-17 6740/week @ 2024-06-24 6599/week @ 2024-07-01 7294/week @ 2024-07-08 5633/week @ 2024-07-15

26,755 downloads per month
Used in 9 crates (4 directly)

Apache-2.0

390KB
10K SLoC

Cargo tests and formatting security audit

Slack Morphism for Rust

Slack Morphism is a modern client library for Slack Web/Events API/Socket Mode and Block Kit.

Documentation

Please follow to the official website: https://slack-rust.abdolence.dev.

Examples

https://github.com/abdolence/slack-morphism-rust/tree/master/examples

The examples require to work the following environment variables (from your Slack bot profile in api.slack.com):

  • SLACK_TEST_TOKEN - for Slack client example
  • SLACK_TEST_APP_TOKEN - for Slack client with Socket Mode example
  • SLACK_CLIENT_ID, SLACK_CLIENT_SECRET, SLACK_BOT_SCOPE, SLACK_REDIRECT_HOST - for OAuth routes for Events API example
  • SLACK_SIGNING_SECRET for all routes for Events API example

To run example use with environment variables:

# SLACK_... cargo run --example <client|events_api_server|axum_events_api_server|socket_mode> --all-features

Routes for this example are available on http://:8080:

  • /auth/install - to begin OAuth installation
  • /auth/callback - a callback endpoint for Slack OAuth profile config
  • /push - for Slack Push Events
  • /interaction - for Slack Interaction Events
  • /command - for Slack Command Events

Testing Events API with ngrok

For development/testing purposes you can use ngrok:

ngrok http 8080

and copy the URL it gives for you to the example parameters for SLACK_REDIRECT_HOST.

Example testing with ngrok:

SLACK_CLIENT_ID=<your-client-id> \
SLACK_CLIENT_SECRET=<your-client-secret> \
SLACK_BOT_SCOPE=app_mentions:read,incoming-webhook \
SLACK_REDIRECT_HOST=https://<your-ngrok-url>.ngrok.io \
SLACK_SIGNING_SECRET=<your-signing-secret> \
cargo run --example events_api_server  --all-features

Licence

Apache Software License (ASL)

Author

Abdulla Abdurakhmanov

Dependencies

~7–21MB
~330K SLoC