{"id":27969168,"url":"https://github.com/future-architect/gbilling2slack","last_synced_at":"2025-05-07T21:08:47.219Z","repository":{"id":57590806,"uuid":"198136601","full_name":"future-architect/gbilling2slack","owner":"future-architect","description":"Slack notifications tools for Google Cloud Platform Billing. ","archived":false,"fork":false,"pushed_at":"2019-07-23T14:34:57.000Z","size":271,"stargazers_count":16,"open_issues_count":10,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T21:08:42.439Z","etag":null,"topics":["cloud-functions","gcp-billing","go","golang","slack","slack-notifications"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/future-architect.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-22T03:01:34.000Z","updated_at":"2023-10-24T07:42:41.000Z","dependencies_parsed_at":"2022-09-26T22:20:27.382Z","dependency_job_id":null,"html_url":"https://github.com/future-architect/gbilling2slack","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/future-architect%2Fgbilling2slack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/future-architect%2Fgbilling2slack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/future-architect%2Fgbilling2slack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/future-architect%2Fgbilling2slack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/future-architect","download_url":"https://codeload.github.com/future-architect/gbilling2slack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252954409,"owners_count":21830905,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud-functions","gcp-billing","go","golang","slack","slack-notifications"],"created_at":"2025-05-07T21:08:46.704Z","updated_at":"2025-05-07T21:08:47.204Z","avatar_url":"https://github.com/future-architect.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gbilling2slack\nSlack notifications tools for Google Cloud Platform Billing. \n\n\u003cimg src=\"https://img.shields.io/badge/go-v1.12-green.svg\" /\u003e\n\n## Overview\n\nThis package notifies gcp billing to your slack channel.\n\n* Cloud Scheduler sends message to Cloud Pub/Sub and Cloud Pub/Sub triggers Cloud Functions. \n* Cloud Functions gets billing from BigQuery table and sends it to your Slack channel.\n* You can see billing on Slack channel.\n\n## Requirements\n\n*Notify GCP Billing to Slack* requires the following to run:\n\n* [Go](https://golang.org/dl/) more than 1.11\n* [Cloud SDK](https://cloud.google.com/sdk/install/)\n\n## Variables\n\n*Notify GCP Billing to Slack* requires only 3 variables to run:\n\n|#  |variables       |Note                             |\n|---|----------------|---------------------------------|\n| 1 |TABLE_NAME      |Table name of billing on BigQuery|\n| 2 |SLACK_API_TOKEN |Slack api token                  |\n| 3 |SLACK_CHANNEL   |Slack channel name               |\n\n\n## Usage\n\nThis package uses below services.\n\n- Google Cloud Billing（BigQuery）\n- Google Cloud Functions\n- Google Cloud Pub/Sub\n- Google Cloud Scheduler\n- Slack API\n\n\n## Steps\n\n1. [Get Slack API Token](https://get.slack.help/hc/en-us/articles/215770388-Create-and-regenerate-API-tokens)\n2. Export your GCP billing to BigQuery ([reference](https://cloud.google.com/billing/docs/how-to/export-data-bigquery))\n3. Set Cloud Scheduler\n```sh\ngcloud beta scheduler jobs create pubsub notify-billing-to-slack --project \u003cYOUR GCP PROJECT\u003e \\\n  --schedule \"55 23 * * *\" \\\n  --topic topic-billing \\\n  --message-body=\"execute\" \\\n  --time-zone \"Asia/Tokyo\" \\\n  --description \"This job invokes cloud function via cloud pubsub and send GCP billing to slack\"\n```\n4. Deploy to Cloud Functions\n```sh\ngcloud functions deploy notifyBilling --project \u003cYOUR GCP PROJECT\u003e \\\n  --entry-point NotifyBilling \\\n  --trigger-resource topic-billing \\\n  --trigger-event google.pubsub.topic.publish \\\n  --runtime go111 \\\n  --set-env-vars TABLE_NAME=\u003cbilling table-name\u003e \\\n  --set-env-vars SLACK_API_TOKEN=\u003cslack-api-token\u003e \\\n  --set-env-vars SLACK_CHANNEL=\u003cslack-channel-name\u003e\n```\n5. Go to the [Cloud Scheduler page](https://cloud.google.com/scheduler/docs/tut-pub-sub) and click the *run now* button of *notify-billing-to-slack*\n\n\n## Example\n\nYou can get below output on slack when it comes to the set time.\n\nThis automatically notify you of charges for all services charged on GCP.\n\n\n![example.png](img/example_output.png)\n\n\n## License\n\nThis project is licensed under the Apache License 2.0 License - see the [LICENSE](LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuture-architect%2Fgbilling2slack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffuture-architect%2Fgbilling2slack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuture-architect%2Fgbilling2slack/lists"}