Skip to content

Instantly share code, notes, and snippets.

@Timtech4u
Created July 11, 2019 00:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Timtech4u/2f59976a183eefe57bb65be247de49b5 to your computer and use it in GitHub Desktop.
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 ⏰
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.',
});
})();
};
{
"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