This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const joinSlackChannel = (channel, message = null) => { | |
return new Promise(async (resolve, reject) => { | |
try { | |
const resp = await web.conversations.join({ | |
channel: channel, | |
}); | |
if (message) { | |
await sendSlackMessage(message, channel); | |
} | |
return resolve(true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { WebClient } = require('@slack/web-api'); | |
const options = {}; | |
const web = new WebClient(process.env.SLACK_TOKEN, options); | |
const sendSlackMessage = async (message, channel = null) => { | |
return new Promise(async (resolve, reject) => { | |
const channelId = channel || process.env.SLACK_CHANNEL_ID; | |
try { | |
const resp = await web.chat.postMessage({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('dotenv').config() | |
const { sendSlackMessage } = require('./utils/slack.util'); | |
console.log('🚀 Slack Notifier 🚀'); | |
const sendMessage = async(message) => { | |
await sendSlackMessage(message); | |
} | |
sendMessage('This is generated by Notifier Test App') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('dotenv').config() | |
const { sendSlackMessage } = require('./utils/slack.util'); | |
console.log('🚀 Slack Notifier 🚀'); | |
const sendMessage = async(message) => { | |
await sendSlackMessage('This is generated by Notifier Test App'); | |
} |