slack_notification 1.2.3 copy "slack_notification: ^1.2.3" to clipboard
slack_notification: ^1.2.3 copied to clipboard

A simple wrapper to post messages from external sources into Slack.

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

flutter pub: 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 #

dependencies:
  slack_notification: ^1.2.2

Simple usage #

final Message message = Message(
    text: "person: Hello World. ${DateTime.now()}",
);

final Response<dynamic> response = await Slack(webHookUrl).send(
    message: message,
);

Advance usage #

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<dynamic> response = await Slack(personUrl).send(
  message: message,
);

Block or Attachment, refer to:

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 #

3
likes
140
pub points
63%
popularity

Publisher

verified publisherhuhx.cn

A simple wrapper to post messages from external sources into Slack.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

dio

More

Packages that depend on slack_notification