10
6 Comments

I’m not a programmer, and I used AI to build my first bot

This is the title of a recent post I saw about a person (Jeff) who built a Slack bot using AI.

The article itself talks about using Replit to build the bot, but you can use pretty much every AI tool (like ChatGPT) to generate the code.

Here's one of the prompts Jeff used:

Generate code that allows me to call on the Slack API and log the messages from a specific Slack channel

Jeff then wasn't sure how to deal with Slack's permission and he asked AI for help:

img

**About "I'm not the programmer part"": I kinda disagree with the premise of the article. You DO need to know some programming concepts in order to come up with a prompt like the one above. You need to know:

  • What is an API
  • Have a general knowledge about the Slack API
  • Know about "logging" (a term a non-programmer wouldn't be familiar with)
  • ...etc.

This leads me to my final point...**all this is good news for IHers...who know how to solve a problem with coding". Instead of you writing 30 lines of code, you can prompt the AI and come with a "good enough" solution.

All this can drastically shorten the time it takes you to come up with an MVP/side project. This way you can test more products/MVPs in a shorter find period and find what works for you faster.

on October 9, 2023
  1. 1

    We have created GPTBots to allow users to create bots quickly without the need for programming knowledge. You just need to import a knowledge base for debugging.

  2. 1

    From experience, I personally recommend using AI for little snippets of deployable and executable code generation, rather than committing the responsibility of creating an entire app for you. That will be like those dystopian movies where the fate of the world rest on the kids to deliver when the adults are absent. However, more simpler logics can be outsourced to your AI, on the other end, unconventional custom solutions and even more complex logics, yeah don't think about it. Except you will adopt a modular prompt strategy and build the pieces together and that in fact requires technical knowledge to an extent. So save your time, which is the reason you're using AI in the first place, don't allow the very thing that should 10x your productivity destroy it.

  3. 1

    Thank you for sharing!

  4. 1

    To call the Slack API and log messages from a specific Slack channel, you'll need to use a programming language like Python. Below is a brief example of Python code that accomplishes this using the Slack API and the slackclient library. This code assumes you have already set up a Slack App and have the necessary API token:

    import os
    from slack import WebClient
    from slack.errors import SlackApiError

    # Set your Slack API token as an environment variable
    slack_api_token = os.environ['SLACK_API_TOKEN']

    # Initialize the Slack API client
    client = WebClient(token=slack_api_token)

    # Define the channel you want to log messages from
    channel_id = "YOUR_CHANNEL_ID"

    # Function to log messages from the specified channel
    def log_messages(channel_id):
    try:
    # Call the conversations.history API to fetch messages
    response = client.conversations_history(channel=channel_id)
    messages = response['messages']

        # Iterate through the messages and log them
        for message in messages:
            # You can customize how you want to log the messages here
            print(f"User: {message['user']} - Message: {message['text']}")
    
    except SlackApiError as e:
        print(f"Error fetching messages: {e.response['error']}")
    

    if name == "main":
    log_messages(channel_id)
    Please note that you'll need to replace "YOUR_CHANNEL_ID" with the actual ID of the Slack channel you want to log messages from. Additionally, make sure to set the SLACK_API_TOKEN environment variable with your Slack API token.

    This code uses the slackclient library to interact with the Slack API and fetch messages from the specified channel. You can further enhance this code by adding message logging to a file or database and handling pagination for long conversations.

    The above code is a concise example of how to get started. For a production-ready solution, you may want to add error handling, pagination support for long conversations, and consider the security aspects of storing API tokens.

  5. 1

    How long did it take you to build the bot with the help of AI?
    Did you use another additional resource like YouTube, etc?