Created
July 11, 2019 00:41
-
-
Save Timtech4u/2f59976a183eefe57bb65be247de49b5 to your computer and use it in GitHub Desktop.
Cloud Function Code for Blog Post :: Building a Slack Reminder App 🤖 with Google Cloud Functions ⚡ and Google Cloud Scheduler ⏰
This file contains 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 IncomingWebhook = require('@slack/webhook').IncomingWebhook; | |
const url = "https://hooks.slack.com/services/XYZ"; | |
const webhook = new IncomingWebhook(url); | |
// Send the notification - Gets callled by Cloud Scheduler | |
module.exports.sendToSlack = () => { | |
(async () => { | |
await webhook.send({ | |
icon_emoji: ':male-police-officer:', | |
text: '@here Take a coffee break.', | |
}); | |
})(); | |
}; |
This file contains 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
{ | |
"name": "cloud-functions-scheduler-slack", | |
"version": "0.0.1", | |
"description": "Google Cloud Functions and Cloud Scheduler - Building a Slack Reminder Bot", | |
"main": "index.js", | |
"dependencies": { | |
"@slack/webhook": "^5.0.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment