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

Vu
0

 

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

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

KeyDefaultType
text“hello, world”string
channel“#general”string
username“bot”string
icon_emoji“:robot_face:”string

📝 License

MIT. Made with ❤️ by cmg8431

GitHub

View Github

Post a Comment

0Comments

Post a Comment (0)

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Check Now
Ok, Go it!