react-slack-webhook
📢 Send a message directly to a Slack channel from a React app
📦 Installation
$ npm install react-slack-webhook
$ yarn add react-slack-webhook
$ pnpm add react-slack-webhook
🚀 Usage
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
🎈 Props
Key | Default | Type |
---|---|---|
text | “hello, world” | string |
channel | “#general” | string |
username | “bot” | string |
icon_emoji | “:robot_face:” | string |