An open API service indexing awesome lists of open source software.

https://github.com/cmg8431/react-slack-webhook

📢 Send a message directly to a Slack channel from a React app
https://github.com/cmg8431/react-slack-webhook

alerts error-reporting notifications reactjs slack webhooks

Last synced: 4 months ago
JSON representation

📢 Send a message directly to a Slack channel from a React app

Awesome Lists containing this project

README

          

react-slack-webhook


📢 Send a message directly to a Slack channel from a React app



downloads


npm version


MIT license


Coverage Status


## 📦 Installation
```bash
$ npm install react-slack-webhook
$ yarn add react-slack-webhook
$ pnpm add react-slack-webhook
```


## 🚀 Usage

```ts
import { Slack } from 'react-slack-webhook';
import { SLACK_WEBHOOK_URL } from '@/constants'

...
const onClick = () => {
const slack = new Slack(SLACK_WEBHOOK_URL)

return slack.send({
text: 'hello, world',
channel: '#channel',
username: 'bot',
icon_emoji: ':robot_face:',
})
}
...
```

[More Example]('https://github.com/cmg8431/react-slack-webhook/tree/main/example')


## 🎈 Props
| Key | Default | Type |
| --- | --- | --- |
| text | "hello, world" | string |
| channel | "#general" | string |
| username | "bot" | string |
| icon_emoji | ":robot_face:" | string |


## 📝 License

[MIT](./LICENSE). Made with ❤️ by [cmg8431](https://github.com/cmg8431)