File tree Expand file tree Collapse file tree 2 files changed +4
-10
lines changed
Expand file tree Collapse file tree 2 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -23,19 +23,14 @@ const PROJECT_NAME = `projects/${PROJECT_ID}`;
2323// [END functions_billing_limit]
2424
2525// [START functions_billing_slack]
26- const { App } = require ( '@slack/bolt ' ) ;
26+ const { WebClient } = require ( '@slack/web-api ' ) ;
2727
2828// TODO(developer) replace these with your own values
2929const BOT_ACCESS_TOKEN =
3030 process . env . BOT_ACCESS_TOKEN || 'xxxx-111111111111-abcdefghidklmnopq' ;
31- const SLACK_SIGNING_SECRET =
32- process . env . SLACK_SIGNING_SECRET || 'default-signing-secret' ;
3331const CHANNEL = process . env . SLACK_CHANNEL || 'general' ;
3432
35- const app = new App ( {
36- token : BOT_ACCESS_TOKEN ,
37- signingSecret : SLACK_SIGNING_SECRET ,
38- } ) ;
33+ const slackClient = new WebClient ( BOT_ACCESS_TOKEN ) ;
3934
4035exports . notifySlack = async pubsubEvent => {
4136 const pubsubAttrs = pubsubEvent . attributes ;
@@ -45,8 +40,7 @@ exports.notifySlack = async pubsubEvent => {
4540 ) } , ${ pubsubData } `;
4641
4742 try {
48- await app . client . chat . postMessage ( {
49- token : BOT_ACCESS_TOKEN ,
43+ await slackClient . chat . postMessage ( {
5044 channel : CHANNEL ,
5145 text : budgetNotificationText ,
5246 } ) ;
Original file line number Diff line number Diff line change 1616 "dependencies" : {
1717 "@google-cloud/billing" : " ^4.0.0" ,
1818 "@google-cloud/compute" : " ^4.0.0" ,
19- "@slack/bolt " : " ^4.2 .1" ,
19+ "@slack/web-api " : " ^7.9 .1" ,
2020 "google-auth-library" : " ^9.0.0" ,
2121 "googleapis" : " ^143.0.0"
2222 },
You can’t perform that action at this time.
0 commit comments