slack 2.0.0

  • README.md
  • Installing
  • Versions
  • 70

dart-slack #

Dartlang interface to the Slack Webhook API

API Documentation available on Pub

Simple Start #

import 'package:slack/html/slack';
// or 
import 'package:slack/io/slack';

main() {
  Slack slack = new Slack('webhook-url');
  Message message = new Message('foo message',username:'bar-user');      
  slack.send(message);
}

Attachment Support #

Minimally attachments require a 'fallback' [String], in the first field.

Attachment bugReport = new Attachment("I can't use Slack!",
   pretext: 'A Critical Bug Reported',
   text   : "I can't use Slack!",
   color  : 'danger');

Message message = new Message('Bug Report:', username: 'bugBot', attachments: [bugReport]);
slack.send(message);

Cascades #

Messages, Attachments, and Fields are mostly just data containers. This means that you have a choice between setting their values in the constructor or setting them in a cascade. For example, Attachments could be defined like so:

Attachment bugReport = new Attachment("I can't use Slack!")
   ..pretext = 'A Critical Bug Reported'
   ..text   = "I can't use Slack!"
   ..color  = 'danger';

Message message = new Message('Bug Report:')
    ..username    = 'bugBot'
    ..attachments = [bugReport];
slack.send(message);

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  slack: ^2.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:slack/html/slack.dart';
import 'package:slack/io/slack.dart';
  
Version Uploaded Documentation Archive
2.0.0 Jan 28, 2019 Go to the documentation of slack 2.0.0 Download slack 2.0.0 archive
1.2.2 Jun 6, 2015 Go to the documentation of slack 1.2.2 Download slack 1.2.2 archive
1.2.1+1 Jun 4, 2015 Go to the documentation of slack 1.2.1+1 Download slack 1.2.1+1 archive
1.2.1 Jun 4, 2015 Go to the documentation of slack 1.2.1 Download slack 1.2.1 archive
1.2.0 Jun 4, 2015 Go to the documentation of slack 1.2.0 Download slack 1.2.0 archive
1.0.3 Aug 22, 2014 Go to the documentation of slack 1.0.3 Download slack 1.0.3 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
53
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
68
Overall:
Weighted score of the above. [more]
70
Learn more about scoring.

We analyzed this package on Apr 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14

Platforms

Detected platforms: web

Platform components identified in package: html, io.

Health suggestions

Fix lib/io/slack.dart. (-1 points)

Analysis of lib/io/slack.dart reported 2 hints:

line 3 col 8: Unused import: 'dart:async'.

line 4 col 8: Unused import: 'dart:io'.

Format lib/src/slacksrc.dart.

Run dartfmt to format lib/src/slacksrc.dart.

Maintenance issues and suggestions

Provide a file named CHANGELOG.md. (-20 points)

Changelog entries help developers follow the progress of your package. See the example generated by stagehand.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and slack.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

The package description is too short. (-2 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
http ^0.11.2 0.11.3+17 0.12.0+2
Transitive dependencies
async 2.2.0
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
meta 1.1.7
path 1.6.2
source_span 1.5.5
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6