Skip to content
المشاريع

abdolence/slack-morphism-rust

عرض على GitHub

حول

A modern async client library for Rust, supports Slack Web / Events API/Socket Mode and Block Kit.

أدوات التطوير

كيف تُقاس هذه الأرقام

النمو المقاس للنجوم

خلال 24 ساعة
٠
خلال 7 أيام
٠
خلال 15 يومًا
+٢
خلال شهر
جارٍ جمع السجل

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

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_TEST_CHANNEL - the channel to post to, for the blocks_showcase 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|blocks_showcase> --all-features

blocks_showcase posts a single message covering every Block Kit block family (header, section, image, context, actions, divider, rich text, table, markdown, alert, card, task card) and prints a modal view for pasting into Block Kit Builder.

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

Date and time types

Dates and times in the models are exposed through the type aliases SlackUtcDateTime and SlackCivilDate, which are backed by jiff (jiff::Timestamp and jiff::civil::Date).

Versioning

Breaking changes in the models that come from changes on the Slack side are released as minor versions. For example, when Slack starts to accept a request without some field, that field becomes optional in the model and its constructors change in a minor release.

Migration notes for such changes are available in the release notes.

Licence

Apache Software License (ASL)

Author

Abdulla Abdurakhmanov

with the great help of contributors, particularly:

  • Naoki Ikeguchi (@siketyan)
  • David Rousselie (@dax)

and many others

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…