Skip to content

Instantly share code, notes, and snippets.

@Timtech4u Timtech4u/index.js
Created Jul 11, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.