Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/huhx/slack_notification
Slack notification in Dart
https://github.com/huhx/slack_notification
dart flutter slack
Last synced: 17 days ago
JSON representation
Slack notification in Dart
- Host: GitHub
- URL: https://github.com/huhx/slack_notification
- Owner: huhx
- License: mit
- Created: 2023-03-14T00:36:06.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-14T14:51:03.000Z (almost 2 years ago)
- Last Synced: 2024-11-18T22:35:39.616Z (3 months ago)
- Topics: dart, flutter, slack
- Language: Dart
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
## Features
Incoming Webhooks are a simple way to post messages from apps into Slack. Creating an Incoming Webhook gives you a unique URL to which you send a JSON payload with the message text and some options. You can use all the usual formatting and layout blocks with Incoming Webhooks to make the messages stand out.![Example message with attachment showing full range of fields](https://a.slack-edge.com/02c4a07/img/api/message_example_with_attachments.png)
**flutter pub**: [https://pub.dev/packages/slack_notification](https://pub.dev/packages/slack_notification)
## Getting started
Before use Incoming Webhooks, we need to create `Slack` app. The setup link: https://api.slack.com/messaging/webhooks## Usage
After create `Slack` and add `Webhooks`, remeber the Webhook URL(this data is sentive include secret, just be careful).
### Add dependencies
```yaml
dependencies:
slack_notification: ^1.2.2
```### Simple usage
```dart
final Message message = Message(
text: "person: Hello World. ${DateTime.now()}",
);final Response response = await Slack(webHookUrl).send(
message: message,
);
```### Advance usage
```dart
final Message message = Message(
text: "person: Hello World. ${DateTime.now()}",
blocks: [
SectionBlock(
text: {
"type": "mrkdwn",
"text": "Danny Torrence left the following review for your property:"
},
),
SectionBlock(
fields: [
{"type": "mrkdwn", "text": "*Average Rating*\n1.0"}
],
)
],
);final Response response = await Slack(personUrl).send(
message: message,
);
````Block` or `Attachment`, refer to:
* Block:https://api.slack.com/reference/block-kit/blocks
* Attachents: https://api.slack.com/reference/messaging/attachments
> This feature of `Attachents` is a legacy part of messaging functionality for Slack apps. We recommend you stick with layout `blocks`## Drop a ⭐ if it is help to you.