Coded Geekery

BlogWritingAboutContact
BlogWritingAboutContact

Slack

Send a Slack Mesasage

sendSlackMessage.js
export const sendSlackMessage = (message) => { fetch(process.env.SLACK_WEBHOOK_URL, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ text: message, }), }) }

Usage#

  • Create a Slack App

  • First, follow these instructions to create an incoming webhook.

  • How to use it

  • import { sendSlackMessage } from "./sendSlackMessage"; // Send the message! sendSlackMessage("Hello world!")

    Not Playing

    Spotify

    Coded Geekery

    TwitterGitHubInstagramgumroadbuymeacoffee

    Stuff

    HomeAbout MeContact Me

    © 2022 Roger Stringer. All rights reserved.