{"id":22147147,"url":"https://github.com/kaicoh/slack-messaging","last_synced_at":"2025-07-19T22:04:53.057Z","repository":{"id":82326460,"uuid":"605131150","full_name":"kaicoh/slack-messaging","owner":"kaicoh","description":"A library to build messages for slack app.","archived":false,"fork":false,"pushed_at":"2025-06-22T06:54:06.000Z","size":317,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-22T07:29:49.721Z","etag":null,"topics":["incoming-webhook","slack","slack-api","webhook"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaicoh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-02-22T14:10:14.000Z","updated_at":"2025-05-11T09:29:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"c9770609-d960-4a00-9332-91ee6db96242","html_url":"https://github.com/kaicoh/slack-messaging","commit_stats":{"total_commits":69,"total_committers":2,"mean_commits":34.5,"dds":0.01449275362318836,"last_synced_commit":"5f75a14dd7713f68f747a85433b91f9c78e54151"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/kaicoh/slack-messaging","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaicoh%2Fslack-messaging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaicoh%2Fslack-messaging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaicoh%2Fslack-messaging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaicoh%2Fslack-messaging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaicoh","download_url":"https://codeload.github.com/kaicoh/slack-messaging/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaicoh%2Fslack-messaging/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266026239,"owners_count":23866031,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["incoming-webhook","slack","slack-api","webhook"],"created_at":"2024-12-01T23:13:37.391Z","updated_at":"2025-07-19T22:04:53.041Z","avatar_url":"https://github.com/kaicoh.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Slack Messaging\n\n[![Version](https://img.shields.io/crates/v/slack-messaging)](https://crates.io/crates/slack-messaging)\n[![License](https://img.shields.io/crates/l/slack-messaging)](LICENSE)\n[![Test](https://img.shields.io/github/actions/workflow/status/kaicoh/slack-messaging/test.yml)](https://github.com/kaicoh/slack-messaging/actions/workflows/test.yml)\n\nThis is a library for [Rust](https://www.rust-lang.org/) to support building [Slack Block Kit messages](https://docs.slack.dev/reference/block-kit).\nUsing this, you can build any messages in type-safe way like following.\n\n```rust\nuse slack_messaging::{mrkdwn, Message};\nuse slack_messaging::blocks::{elements::Button, Actions, Section};\n\n#[tokio::main]\nasync fn main() {\n    let message = Message::builder()\n        .block(\n            Section::builder()\n                .text(mrkdwn!(\"You have a new request:\\n*\u003cfakeLink.toEmployeeProfile.com|Fred Enriquez - New device request\u003e*\"))\n                .build()\n        )\n        .block(\n            Section::builder()\n                .field(mrkdwn!(\"*Type:*\\nComputer (laptop)\"))\n                .field(mrkdwn!(\"*When:*\\nSubmitted Aug 10\"))\n                .build()\n        )\n        .block(\n            Actions::builder()\n                .element(\n                    Button::builder()\n                        .text(\"Approve\")\n                        .value(\"approve\")\n                        .primary()\n                        .build()\n                )\n                .element(\n                    Button::builder()\n                        .text(\"Deny\")\n                        .value(\"deny\")\n                        .danger()\n                        .build()\n                )\n                .build()\n        )\n        .build();\n\n    let req = reqwest::Client::new()\n        .post(\"https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX\")\n        .json(\u0026message);\n\n    if let Err(err) = req.send().await {\n        eprintln!(\"{err}\");\n    }\n}\n```\n\nThe message payload of the above example is following.\n\n```json\n{\n    \"blocks\": [\n        {\n            \"type\": \"section\",\n            \"text\": {\n                \"type\": \"mrkdwn\",\n                \"text\": \"You have a new request:\\n*\u003cfakeLink.toEmployeeProfile.com|Fred Enriquez - New device request\u003e*\"\n            }\n        },\n        {\n            \"type\": \"section\",\n            \"fields\": [\n                {\n                    \"type\": \"mrkdwn\",\n                    \"text\": \"*Type:*\\nComputer (laptop)\"\n                },\n                {\n                    \"type\": \"mrkdwn\",\n                    \"text\": \"*When:*\\nSubmitted Aug 10\"\n                }\n            ]\n        },\n        {\n            \"type\": \"actions\",\n            \"elements\": [\n                {\n                    \"type\": \"button\",\n                    \"text\": {\n                        \"type\": \"plain_text\",\n                        \"text\": \"Approve\"\n                    },\n                    \"value\": \"approve\",\n                    \"style\": \"primary\"\n                },\n                {\n                    \"type\": \"button\",\n                    \"text\": {\n                        \"type\": \"plain_text\",\n                        \"text\": \"Deny\"\n                    },\n                    \"value\": \"deny\",\n                    \"style\": \"danger\"\n                }\n            ]\n        }\n    ]\n}\n```\n\n## Optional Features\n\nThe following are a list of [Cargo features](https://doc.rust-lang.org/stable/cargo/reference/features.html#the-features-section) that can be enabled or disabled.\n\n### fmt\n\nEnable `fmt` module and format messages in [this way](https://docs.slack.dev/messaging/formatting-message-text#date-formatting).\n\n```rust\nuse chrono::prelude::*;\nuse slack_messaging::fmt::DateFormatter;\n\n// Formatter without optional link.\nlet f = DateFormatter::builder()\n    .token(\"{date_short} at {time}\")\n    .build();\n\nlet dt = DateTime::parse_from_rfc3339(\"2023-02-27T12:34:56+09:00\").unwrap();\n\nassert_eq!(\n    f.format(\u0026dt),\n    \"\u003c!date^1677468896^{date_short} at {time}|Feb 27, 2023 at 12:34 PM\u003e\"\n);\n\n// You can also set optional link when formatting.\nassert_eq!(\n    f.format_with_link(\u0026dt, \"https://example.com\"),\n    \"\u003c!date^1677468896^{date_short} at {time}^https://example.com|Feb 27, 2023 at 12:34 PM\u003e\"\n);\n\n// Formatter with optional link.\nlet f = DateFormatter::builder()\n    .token(\"{date_short} at {time}\")\n    .link(\"https://example.com\")\n    .build();\n\n// This time, format method returns text with link set to the formatter.\nassert_eq!(\n    f.format(\u0026dt),\n    \"\u003c!date^1677468896^{date_short} at {time}^https://example.com|Feb 27, 2023 at 12:34 PM\u003e\"\n);\n```\n\n## License\n\nThis software is released under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaicoh%2Fslack-messaging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaicoh%2Fslack-messaging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaicoh%2Fslack-messaging/lists"}