Welcome to the Daily BigQuery Report to Slack Template! This template is designed to help you automate the process of fetching data from BigQuery, formatting it into an easy-to-read table, and sending this report to a Slack channel of your choice. This is particularly useful for teams who need to keep track of key metrics and want to receive daily updates without manual intervention.
To begin using this template, simply click on "Start with this Template" on the Lazy platform. This will set up the template in your Lazy Builder interface, ready for customization and use.
Before you can use this template, you'll need to set up a couple of environment secrets that the code requires to function properly:
To add these environment secrets, navigate to the Environment Secrets tab within the Lazy Builder and enter the key-value pairs for the SLACK_API_TOKEN and SLACK_CHANNEL.
Once you have configured the environment secrets, it's time to test the app to ensure everything is working as expected. Press the "Test" button in the Lazy Builder. This will deploy the app and launch the Lazy CLI.
If the template code requires any user input through the CLI, you will be prompted to provide it after pressing the Test button. In this template, there is no need for additional user input as the query and Slack channel are already defined in the code and environment secrets.
There is no frontend experience for this app as its primary function is to send data to Slack. Once the app is running, it will automatically perform its task without further interaction.
After testing the app and confirming that the reports are being sent to your Slack channel, you may want to customize the QUERY and TITLE in the code to match the specific data you wish to report on. Replace the placeholder text in the QUERY constant with your actual BigQuery SQL query and update the TITLE constant with a descriptive title for your report.
Remember, you can always modify the scheduler settings in the code if you need the report to be sent at a different time or with a different frequency. The scheduler is currently set to trigger the send_metrics function every day at 10 am UK time.
If you need to refer to any documentation or require assistance, please use the links provided in the code comments or reach out to the Lazy customer support for further help.
That's it! You're now ready to receive daily BigQuery reports in your Slack channel, all automated through your Lazy app.