Welcome to the Slack Send & Post Message app template! This template is designed to help you create an application that listens to messages in a Slack channel and responds privately to the user with a quote of the original message and the channel name. It uses the built-in 'llm_prompt' ability to generate responses, ensuring a seamless and interactive experience within Slack. This step-by-step guide will walk you through the process of setting up and deploying your app on the Lazy platform.
To begin using this template, simply click on "Start with this Template" on the Lazy platform. This will pre-populate the code in the Lazy Builder interface, so you won't need to copy or paste any code manually.
Before you can test and deploy your app, you'll need to set up a couple of environment secrets within the Lazy Builder. These secrets are the Slack Bot Token and Slack App Token, which are essential for authenticating your app with Slack's API.
Make sure to enable Event Subscriptions and subscribe to the 'message.channels', 'message.im', and 'message.groups' bot events in your Slack App settings.
Once you have set up the environment secrets, press the "Test" button on the Lazy platform. This will deploy your app and launch the Lazy CLI. If the code requires any user input, you will be prompted to provide it through the Lazy CLI.
After deployment, your app will be running and listening to messages in the Slack channel it has been added to. When a user sends a message, the app will generate a response using the 'llm_prompt' ability and send a private message back to the user with the response formatted as a quote of the original message, including the channel name.
With your app now running, you can integrate it into your Slack workspace by inviting the bot to the channels you want it to listen to. Use the '/invite @YourBotName' command in Slack to add the bot to a channel.
If you need to make any adjustments or further integrate the app with other tools or services, you can refer to the Slack API documentation provided in the code for guidance:
https://api.slack.com/
Remember, the Lazy platform handles all deployment aspects, so you don't need to worry about installing libraries or setting up your environment. Enjoy building and using your Slack Send & Post Message app!
This app allows users to interact with a Slack bot, ask a question about the data in a table or request the table schema, and then uses the latest ChatGPT to generate a query that is executed on BigQuery to return the results. The app includes a retry mechanism for query generation in case of an error (up to two retries) and provides the LLM with the table info to generate more accurate queries. The table schema is only printed if it is successfully retrieved. All errors from retries are now passed to the LLM. The generated query is printed before the results, and the results are displayed in a pretty table format. The bot uses the Slack API to send and receive messages and parses the user's message to determine the action to take. The bot always responds in a thread to the original message.