
Explore building Slack apps with Python and Slack Bolt, from setting up a Slack app to core operations, demos like weather, translation, raffle, and commands, webhooks, shortcuts.
Set up a Slack app in your workspace from scratch, choosing a name and workspace, navigating the app creation menu, and preparing for essential settings covered in upcoming lessons.
Enable socket mode for your Slack bot to interact without a public URL, add the connections:write scope, and generate and securely store the app-level token starting with xapp.
Configure OAuth and permissions for a Slack bot by managing bot token scopes like chat:write, channels:read, groups:read, and reactions:read/write. Install the app and safeguard the bot token.
Enable event subscriptions to receive messages and reactions, and subscribe to bot events in private and public channels. Reinstall the app to apply settings and add it to a channel.
Install Python and set up the development environment, including adding python.exe to PATH; platform-specific installers (exe on Windows, pkg on Mac) and then install PyCharm for efficient Python development.
Install and configure PyCharm, selecting the community edition and adding the bin path for easy access, then create a new project and prepare for interpreter setup in upcoming lectures.
Install and configure Anaconda to manage multiple Python environments, including selecting the right options, registering as default for PyCharm, and avoiding adding Anaconda to path.
Create and activate a conda virtual environment named slack-bot with python=3.12, configure PyCharm to use it, and prepare to install packages for a basic Python coding tutorial.
Learn Python basics for building a Slack app, including variables, integers, floats, and strings. Explore arithmetic on numbers and strings, use comments, and apply type conversions with str and int.
Explore the boolean data type and core logical operations, compare values with == and !=, and apply and, or, not with proper parentheses.
Master lists and dictionaries in Python for Slack apps, using append, remove, and concatenation; learn key-value pairs, nesting, unique keys, del removal, and why lists or dictionaries cannot be keys.
Learn to index and slice lists and dictionaries in Python, using 0-based and negative indexing, nested structures, and the dict.get method for safe access.
Learn to structure Python conditional statements with if, elif, and else, using colons, indentation, and scoped blocks, and combine conditions with and or, with optional else for unmatched cases.
Learn to use Python for loops with range, lists, and dictionaries, emphasizing indentation, print behavior, and nesting to filter even elements using modulo.
Explore while loops that repeat actions while a condition holds, with indentation and incrementing index, and breaking when the condition is met; compare them to for loops and avoid infinite loops.
Explore exception handling with try-except, illustrating try blocks, the except block, colon and indentation, plus f-strings, division by zero, and a for loop example.
Learn to implement and use Python functions with def, input values, and returns, including multiple inputs, default parameters, and control structures like for and while loops.
Learn how Python modules power code by importing entire modules or specific functions, aliasing with as, and installing external packages via pip in a conda virtual environment.
Tackle five practice problems on the basics of python, covering string processing with for loops, dictionary indexing, printing elapsed time with time module, and nested loops to print multiplication tables.
Review solutions to practice problems in Python basics, including counting 'a' with a for loop and conditional, dictionary and list indexing, time.time and time.sleep, and f-strings.
Learn the main code structure of a Slack app in Python, manage tokens with environment variables and dotenv, install slack_bolt, and start the socket mode bot.
Learn to read and write JSON in Python using the json module, load and dump data, and modify a sample file to include location for a Slack bot.
Fetch and parse json data to communicate with Slack server in a Slack app, using a decorator, read args, convert to a dict with __dict__, and extract channel_id and text.
Learn to send messages with a Slack app by replying to 'hello world' with 'hello python!', using channel id, event ts, and the say function to post a threaded reply.
Add and remove a thumbs-up emoji in Slack when a message contains 'good', pausing five seconds with sleep, using client.reactions_add and client.reactions_remove with channel and timestamp.
Learn how a Python Slack bot uses Slack Bolt to respond to message edits via the message_changed subtype, manage keywords hello world, and update replies with chat_update.
Learn to handle Slack message deletions in a Python Slack Bolt app by recognizing channel message_deleted and thread message_changed with tombstone, deleting the bot message via chat_delete, and filtering duplicates.
Develop a Slack app that responds to emoji reactions using reaction_added and reaction_removed, posting a 'Hello!' message with say and deleting it with chat_delete when emojis are added or removed.
Create history.json and manage timestamp records with load_timestamp, add_timestamp, and delete_timestamp to persist data after restart. Acknowledge json storage limits and consider Redis for reliability.
Customize a Slack bot by setting emoji and username with say or client.chat_update, using chat:write:customize and app reinstallation to run as multiple bots.
Demonstrate configuring a Slack Bolt app to post distinct messages in two channels with unique icons and names, while not responding in other channels.
Apply conditional branching with if-elif-else in a Slack Bolt Python app to send different replies per channel using channel IDs, messages, emojis, and usernames.
Develop a Slack Python app that manages a json file, supporting add, delete, lookup, and clear commands, with robust load-modify-write cycles and command parsing.
Explore what an API is and how to call a weather API in Python using requests, dotenv for the API key, and handle 200 and 401 responses.
Develop a Slack Bolt bot in Python that fetches weather via a weather API, uses environment variables for keys, and returns city, temperature, and emoji-based conditions.
Translate Slack messages to French using googletrans in a Python bot, install version 4.0.0-rc1, create a translator, and update or delete translations with say and client_update.
Look up a user's real name by id with the users_info method, requiring the users:read scope and app reinstall to fetch user data and view the name in the terminal.
Build a random raffle app for Slack Bolt that fetches channel members with conversations_members, uses random.choice to pick a non-app user, resolves real_name via users_info, and displays result with say.
Build a Slack bot in Python that records attendance on 'check' using local time, stores per-date user times in a dictionary, and shows today's results with 'today result'.
Explore advanced Slack bot features with Python and Slack Bolt, focusing on slash commands like /set_hello_message, file-based read/write for responses, and command handling with ack.
Configure Slack incoming webhooks to send messages to a channel, generate and secure the webhook URL, guard the URL, load it from dotenv, and post a json payload with requests.
Explore creating a Slack shortcut that opens a modal with a simple text input, using Slack Bolt's views_open and a callback_id like open_modal for message modification.
Implement a modal workflow in a Slack Bolt Python bot using edit_callback and app.view. Serialize channel_id and timestamp with private_metadata via json.dumps, then update the app message with client.chat_update.
Explore implementing an asynchronous Slack app using async def, await, and the AsyncApp and AsyncSocketModeHandler, with setup notes for aiohttp and Python 3.10 compatibility.
GOAL OF THIS LECTURE
- Able to Implement Key Features of a Slack App in Python
- Becoming Familiar with Features Supported by the Slack API
NICE TO HAVE
- Basic Python Programming Skills(But, even if you are new to Python, it's okay to follow this course.)
- Python Programming Environment Setting(However, there is no need to worry as this course also includes assistance with setting up the environment.)
OUTLINES
Section 0: Introduction
Section 1: Set Slack App Configurations
- Proceed with the settings to create an app on the Slack website.
Section 2: Set Python Programming Environments
- Setup Conda and Pycharm to python programming.
- If the Python programming environment(Conda, Pycharm) has been set up, you can skip this step.
Section 3: Basic Python Programming
- Briefly go over the basic syntax of Python.
- If you are familiar with Python programming, you can skip this step.
Section 4: Basic Operations of Slack Bolt
- Learn the basic operations of Slack Bolt, a module for implementing Slack Apps in Python.
Section 5: Implementing Slack App
- Implement demo Slack apps with actual functionalities, such as a weather app, a translation app, and a raffle app.
Section 6: Advanced Functionality of Slack Bolt
- Cover several advanced features in Slack Bolt that are useful like commands, webhooks and shortcuts.