# @sendyit/slacker

> Lightweight and highly configurable npm package for sending messages to slack channels

Latest version **1.2.0** (published 2019-07-02) · ISC license · 0 weekly downloads

## Install

```sh
npm install @sendyit/slacker
pnpm add @sendyit/slacker
yarn add @sendyit/slacker
bun add @sendyit/slacker
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2019-07-02 |
| First published | 2019-07-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 20 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| Author | Kisiara Francis |
| Maintainers | evanson, fkisiara, isaacomondi, krris, sendy |
| Keywords | slack, notifications, slack notifications, sendy |

## Links

- npm: https://www.npmjs.com/package/@sendyit/slacker
- npm.io page: https://npm.io/package/@sendyit/slacker

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) ^0.19.0
- [dotenv](https://npm.io/package/dotenv.md) ^8.0.0
- [dateformat](https://npm.io/package/dateformat.md) ^3.0.3

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2019-07-02
- 1.1.0 — 2019-07-02
- 1.0.0 — 2019-07-01
- 0.0.3 — 2019-07-01
- 0.0.2 — 2019-07-01
- 0.0.1 — 2019-07-01

## README

# Sendy Slacker

Lightweight and highly configurable npm package for sending messages to slack channels

## Prerequisites

You will need to have node installed and running in your environment to use sendy slacker

## Installing

To install sendy slacker run the following command in your terminal within the root folder of your application

```
npm install @sendyit/slacker
```

## Usage
To use sendy-slacker import the library: 
```javascript
const Slacker = require('@sendyit/slacker'); 
```
Instantiate `Slacker` and add any parameters that are available:
```javascript
const slacker = new Slacker({
  footer: 'Test Footer'
});

const data = {
  title: 'This is a test title',
  text: 'This is some sort of test message!',
};

slacker.alert_level = 'warning';

slacker.report('backend', data);
```

## Configuration
### Using Environment Variables
With a new instance of `Slacker` you can add parameters with environment variables as follows. 
The `dotenv` package is a dependency for this project to load any .env file you have
- Create a .env file in your root folder

add the following or copy from `sample.config.env` file from the root folder:
```shell
SLACK_BASE_URL = "https://hooks.slack.com/services/T00000000"
FOOTER = "Sample Footer message"
FOOTER_ICON = "http://sampleurl/for/footer_icon.png"
```

You can define your channels in the base `slack.config.js` but it is advisable to use the parameters in the instance to define the channels as you'll see below. 

### Using the Instantiated Object
We can also define all parameters in the newly instantiated `Slacker` object as follows:
```javascript
const slacker = new Slacker({
  base_url: 'https://hooks.slack.com/services/T00000000',
  channels: {
    channel1: '/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX',
    channel2: '/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX',
  },
  footer: 'Test Footer',
  footer_icon: 'http://url/to/footer/icon.png'
});
```
The channels object constitute any channel links you have from you Slack workspace. More information on this can be found at [Slack's API Documentation]('https://api.slack.com/incoming-webhooks')

#### Alerts 
Set an alert level for sending a color-coded slack message. 

We have default color-coded alert levels but these can be overridden when instantiating the `Slacker` object by adding the `alerts` object as a parameter. 

```javascript
alerts: {
  notice: '#00800',
  warning: '#1782c5',
  error: '#ff0000',
  default: '#ff0000'
}
```

<!-- Explain how to run the automated tests for this system

### Break down into end to end tests

Explain what these tests test and why

```
Give an example
```

### And coding style tests

Explain what these tests test and why

```
Give an example
``` -->

<!-- ## Deployment

Add additional notes about how to deploy this on a live system

## Built With

* [Dropwizard](http://www.dropwizard.io/1.0.2/docs/) - The web framework used
* [Maven](https://maven.apache.org/) - Dependency Management
* [ROME](https://rometools.github.io/rome/) - Used to generate RSS Feeds

## Contributing

Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us.

## Versioning

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/your/project/tags). 

## Authors

* **Billie Thompson** - *Initial work* - [PurpleBooth](https://github.com/PurpleBooth)

See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

## Acknowledgments

* Hat tip to anyone whose code was used
* Inspiration
* etc -->

---
_Source: https://npm.io/package/@sendyit/slacker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
