Other

Oct 29, 2025

How to Build a Slack Bot using Emergent

Written By :

Arya Chandra

How to Build a Slack Bot using Emergent

Welcome to this step-by-step guide on how to build PollMate, a Slack bot that helps teams create quick polls and vote using reactions. By the end of this tutorial, you will have a working version of PollMate running inside your own Slack workspace. You will be able to start a poll, share it in any channel, and let your teammates vote simply by reacting with emojis.

We will use Emergent to build this bot as it allows you to build without needing to write or manage complex backend code. You will only need a Slack workspace and an Emergent account to get started.

Understanding What We Are Building

Imagine PollMate as a friendly team assistant in your Slack workspace. When someone says, “PollMate, create a new poll,” it listens carefully, sets up the poll, and shares it with everyone. When teammates react with emojis, PollMate quietly counts the votes and can show who is winning. You don’t need to know how it all works behind the scenes because Emergent takes care of all the setup and connections for you.

Building PollMate on Emergent

Now that you understand what PollMate is and how it works, let’s build it on Emergent. Emergent allows you to create entire apps simply by describing them in natural language. You don’t need to manually code or configure APIs. You just tell Emergent what you want, and it automatically sets up the backend, frontend, and deployment for you.

Step 1: The Prompt

When you start building on Emergent, the first thing you do is describe your app idea in a prompt. This is the instruction that tells Emergent what to build.

Here’s the exact prompt used to build PollMate:

Prompt:
“Build a Slack bot called PollMate. It should allow users to create quick polls inside any Slack channel and vote using emoji reactions. When a poll is created, the bot posts a message like ‘Vote for your favorite option!followed by numbered options. Each option has a unique emoji, and users cast their votes by reacting with that emoji.

The bot should count votes in real time and post the results once the poll ends or when the creator clicks ‘End Poll.

Requirements:

Use Python and the slack_bolt library.

Store poll data temporarily in memory (no database needed).

Include slash command /poll to create a new poll.

Allow up to 5 options per poll.

Automatically calculate vote counts based on emoji reactions.

Send a final results message showing option-wise vote totals.

Additional Request:
Generate a simple landing page for PollMate with:

A brief description of the bot and guidelines on how to enable the bot (“Create polls, vote with emojis, and make decisions faster on Slack”).

A ‘Download Code’ button that downloads the Python source file as a .zip.

Minimal styling with Tailwind CSS.

Output the entire codebase as a single downloadable ZIP file through the landing page.

Step 2: How Emergent Responds

Once you enter this prompt, Emergent begins to interpret it and automatically drafts a plan for how it will build your app.
Before writing any code, the Emergent agent may ask you clarifying questions to ensure it fully understands your intent.

Here are the questions it asked during the PollMate build:

  1. Slack API Credentials
    To connect your bot to Slack, Emergent needs three things:
    a. Slack Bot Token (starts with xoxb-)
    b. Slack App Token (starts with xapp-)
    c. Signing Secret

  2. Bot Hosting Approach
    The agent wanted to know where the bot will run:
    a. Should it be designed to run locally on the user’s machine?
    b. Or should the landing page include deployment instructions?

  3. Poll Duration

    1. Should polls run indefinitely until manually ended?

    b. Or should there be an optional time limit feature?

  1. Landing Page Behaviour
    Should the “Download Code” button include only the main Python file, or should it also include setup instructions and a requirements.txt file?

Understanding What Emergent Delivers

Once you confirm the agent’s questions, Emergent generates a single Python file for PollMate. This file contains all the code needed for your bot to function on Slack. It includes the logic for creating polls, assigning emoji reactions, counting votes, and showing results when a poll ends.

You can download this .py file directly from Emergent and run it on your local machine. Before running it, you’ll need to install the required Python libraries (which are usually listed at the top of the file) and connect it to your Slack workspace. Please note: it is not necessary to run the bot locally - you can run the bot on Emergent’s Infrastructure - Emergent sets that up automatically for you - no manual input required

Emergent does not handle the Slack connection automatically. That part requires a few manual steps - creating your Slack app, configuring permissions, and retrieving your tokens. These steps ensure that your PollMate bot can safely communicate with Slack and respond to commands from your workspace.

In the next section, we’ll set up the Slack app for PollMate. You’ll learn how to create the app, upload the manifest file, and collect the necessary credentials - your Bot Token, App Token, and Signing Secret - to make PollMate come alive inside Slack.

How to Setup your Slack Workspace

Option 1: Quick Setup (Recommended)

This is the fastest and easiest way to set up PollMate. The manifest file automatically fills in all the permissions, settings, and configurations your bot needs.

  1. Download the manifest file
    Download the PollMate manifest file provided above. It contains all the details Slack needs to configure the app for you. This is how my manifest file looks like (You can open it in any text editor - you dont need to understand what any of this means - just copy and paste it)



  1. Visit Slack’s developer portal
    Go to api.slack.com/apps.



  1. Create a new app using the manifest
    Click “Create New App” → “From an app manifest.”



  1. Choose your workspace and upload the manifest
    Select your Slack workspace and paste or upload the manifest file you downloaded.



  1. Review and create the app
    Slack will show you a summary of the configuration. Click Create to confirm.



  1. Generate an App-Level Token
    Go to Settings → Basic Information → App-Level Tokens.
    Create a new token with the scope connections:write.
    Copy this token — you’ll need it later as your SLACK_APP_TOKEN.




  1. Install the app to your workspace
    Navigate to OAuth & Permissions → Install App to Workspace and authorize it.
    Copy the Bot User OAuth Token (starts with xoxb-).
    This is your SLACK_BOT_TOKEN.


You now have both tokens required to run PollMate:

  • SLACK_APP_TOKEN (for socket connections)

  • SLACK_BOT_TOKEN (for posting messages and handling commands)

You just need to paste these tokens on Emergent and ask the agent to integrate it in your .env.

Here’s the prompt you can use:

Here are my tokens:

App Token: SLACK_BOT_TOKEN (starts with xoxb-)

Bot Token: SLACK_APP_TOKEN (starts with xapp-)

Please integrate these into my .env file

Option 2: Manual Setup

If you prefer to configure everything yourself, follow these steps instead.

  1. Create a Slack App
    Go to api.slack.com/apps and click Create New App.
    Choose “From scratch” and select your workspace.

  2. Enable Socket Mode
    In your app settings, find Socket Mode and enable it.
    Generate an App-Level Token with the connections:write scope.
    Save it as your SLACK_APP_TOKEN.

  3. Add Bot Permissions
    Go to OAuth & Permissions and add these Bot Token Scopes:

    • chat:write — Allows the bot to post messages

    • commands — Enables slash commands

    • reactions:write — Lets the bot add emoji reactions

    • channels:history — Allows reading messages in public channels

    • groups:history — Allows reading messages in private channels


  4. Install the App to Your Workspace
    Click Install to Workspace and authorize the app.
    Once installed, copy the Bot User OAuth Token (starts with xoxb-) and save it as your SLACK_BOT_TOKEN.

  5. Create a Slash Command
    Go to Slash Commands in your app settings and click Create New Command.
    Use these details:

    • Command: /pollmate

    • Description: Create a quick poll

    • Usage Hint: Question? | Option 1 | Option 2 | ...
      The command will trigger PollMate to post a new poll whenever it’s used in a channel.

  6. Connect Your Tokens in Emergent
    Copy your SLACK_BOT_TOKEN and SLACK_APP_TOKEN, then return to Emergent.
    Paste these into your environment variables section and ask the agent to include them in the Python file. Emergent will automatically insert them into the code so the bot can authenticate with Slack.

Starting and Testing PollMate

Now that your Slack app is connected and your tokens are added to Emergent, it’s time to bring PollMate to life. In this section, you’ll start the bot, invite it to your Slack channel, and create your first interactive poll.

Step 1: Ask the Agent to Start the Bot

Return to Emergent, where your PollMate bot file is ready.
After adding your SLACK_BOT_TOKEN and SLACK_APP_TOKEN as environment variables, ask the agent to start the bot. Emergent will execute the Python file and connect it to your Slack workspace using the provided credentials.

When PollMate starts successfully, you’ll see a confirmation message in the Emergent console such as:

⚡️ PollMate is running and connected to Slack!

This message means the bot is now active and ready to respond inside Slack.


Step 2: Invite PollMate to a Channel

New Slack bots don’t automatically join channels, so you’ll need to invite PollMate manually.
In the Slack channel where you want to use it, type:

/invite @PollMate

Once invited, PollMate will have access to that channel and will be able to post messages, react to emojis, and handle your slash commands.

Step 3: Create a Test Poll

You can now create your first poll. In the same channel, type:

/pollmate What should we order for lunch? | Pizza | Burgers | Sushi

PollMate will post a message like this:

What should we order for lunch?
1️⃣ Pizza
2️⃣ Burgers
3️⃣ Sushi


Each option will include a unique emoji reaction.
Your teammates can vote by clicking on the emoji corresponding to their choice. PollMate records each vote in real time as reactions come in.

Step 4: End the Poll and View Results

When you’re ready to close the poll, simply click the “End Poll” button that appears below the poll message. PollMate will immediately calculate all the votes and post the final results in the channel, showing how many votes each option received.

This makes it easy for everyone to see which choice won without typing any extra commands.


Step 5: Confirm PollMate Is Working

If PollMate responds to your /pollmate command, posts the poll correctly, and ends it with the results displayed, your setup is complete.

You now have a fully functional Slack bot that can help your team make quick decisions through interactive emoji voting.

Wrapping Up

You’ve now successfully built and tested PollMate, your interactive polling bot for Slack. It can create polls, collect emoji-based votes, and display results with a single click. You’ve seen how quickly a fully working Slack bot can be created, configured, and deployed using Emergent.

Now that your bot is working, here are a few ways to make it even better or explore new ideas:

Add Multi-Channel Polling
Allow polls to be shared across multiple channels for broader participation.
Prompt:
“Add multi-channel support to PollMate so users in different channels can vote in the same poll.”

Export Poll Results
Automatically save poll outcomes in a Google Sheet or CSV file.
Prompt:
“Make PollMate export poll results to a Google Sheet after a poll ends.”

Add Custom Emoji Reactions
Let users select their own emojis for poll options.
Prompt:
“Update PollMate to allow custom emoji options for polls.”

Generate beautiful designs in seconds and export to HTML or Figma. Powerful prompt builder with hundreds of templates for responsive web design.

Copyright

Emergentlabs 2024

Design and built by

the awesome people of Emergent 🩵

Generate beautiful designs in seconds and export to HTML or Figma. Powerful prompt builder with hundreds of templates for responsive web design.

Copyright

Emergentlabs 2024

Design and built by

the awesome people of Emergent 🩵

Generate beautiful designs in seconds and export to HTML or Figma. Powerful prompt builder with hundreds of templates for responsive web design.

Copyright

Emergentlabs 2024

Design and built by

the awesome people of Emergent 🩵