Build a Slack Bot That Generates Images

Build a Slack Bot That Generates Images

A Slack bot for image generation is a bot that listens for slash commands, calls an image API with the data, and posts a branded image back to the channel. The whole round-trip takes about 3 seconds, and it's one of the most practical internal tools you can build.

I built one for a team that needed weekly report summary graphics. Every Friday, someone types /report in Slack, fills in the numbers, and gets a branded report card posted to the channel. Took an afternoon to build. It's saved them 30 minutes every week since. Here's how to build your own. All pricing is as of March 2026.

What youll build a slack image generation botWhat You'll Build: A Slack Image Generation Bot

A Slack bot that responds to a slash command (like /generate or /banner), takes input parameters, calls Imejis.io to generate a branded image, and posts it back to the Slack channel.

The flow:

User types: /celebrate Sarah - 5 Year Anniversary
    ↓
Slack sends the command to your bot
    ↓
Bot parses: name = "Sarah", event = "5 Year Anniversary"
    ↓
Bot calls Imejis.io API with the data
    ↓
Image generated in ~2 seconds
    ↓
Bot posts the image to the channel

Total time from command to image: about 3 seconds.

Use casesUse Cases

Before we get into the code, here's what teams actually use this for:

Team celebrations: "/celebrate Sarah - 5 Year Anniversary" generates a branded graphic with the person's name, photo, and milestone. Posted to the #general channel for everyone to see.

Weekly reports: "/report Revenue: $45K, Users: 1,200, NPS: 72" generates a summary card with the key metrics in a branded layout.

Customer notifications: When a new enterprise customer signs up, the bot auto-generates a "Welcome [Company]!" card in #sales.

Social media drafts: "/social Launch day! New feature: dark mode" generates a social media post image and posts it to #marketing for review before publishing. For a full guide on this workflow, see Automate Social Media Images.

Event announcements: "/event Team Offsite - March 28 - San Francisco" generates a branded event card.

Quote graphics: "/quote 'The best way to predict the future is to create it.' - Peter Drucker" generates a shareable quote card.

PrerequisitesPrerequisites

Step 1 create a slack appStep 1: Create a Slack App

  1. Go to api.slack.com/apps and click "Create New App"
  2. Choose "From scratch"
  3. Name it (e.g., "Image Generator") and select your workspace
  4. Under Slash Commands, create a new command:
    • Command: /generate
    • Request URL: https://your-server.com/slack/generate (we'll set this up next)
    • Short description: "Generate a branded image"
  5. Under OAuth & Permissions, add these bot token scopes:
    • commands: for slash commands
    • chat:write: to post messages
    • files:write: to upload images
  6. Install the app to your workspace and copy the Bot User OAuth Token

Step 2 set up your serverStep 2: Set Up Your Server

Create a new Node.js project:

mkdir slack-image-bot && cd slack-image-bot
npm init -y
npm install @slack/bolt dotenv

Create a .env file:

SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_SIGNING_SECRET=your-signing-secret
IMEJIS_API_KEY=your-imejis-api-key
IMEJIS_TEMPLATE_ID=your-template-id

Step 3 write the botStep 3: Write the Bot

import "dotenv/config"
import bolt from "@slack/bolt"
 
const { App } = bolt
 
const app = new App({
  token: process.env.SLACK_BOT_TOKEN,
  signingSecret: process.env.SLACK_SIGNING_SECRET,
})
 
// Handle the /generate slash command
app.command("/generate", async ({ command, ack, client }) => {
  await ack() // Acknowledge the command immediately
 
  const inputText = command.text // e.g., "Sarah - 5 Year Anniversary"
  const [name, event] = inputText.split(" - ").map((s) => s.trim())
 
  if (!name || !event) {
    await client.chat.postEphemeral({
      channel: command.channel_id,
      user: command.user_id,
      text: "Usage: /generate Name - Event (e.g., /generate Sarah - 5 Year Anniversary)",
    })
    return
  }
 
  // Generate the image via Imejis.io
  const imageResponse = await fetch(
    `https://render.imejis.io/v1/${process.env.IMEJIS_TEMPLATE_ID}`,
    {
      method: "POST",
      headers: {
        "dma-api-key": process.env.IMEJIS_API_KEY,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        person_name: { text: name },
        event_text: { text: event },
        date_text: {
          text: new Date().toLocaleDateString("en-US", {
            month: "long",
            day: "numeric",
            year: "numeric",
          }),
        },
      }),
    }
  )
 
  const imageBuffer = Buffer.from(await imageResponse.arrayBuffer())
 
  // Upload and post the image to the channel
  await client.files.uploadV2({
    channel_id: command.channel_id,
    file: imageBuffer,
    filename: `${name.toLowerCase().replace(/\s+/g, "-")}-${Date.now()}.png`,
    title: `${name} - ${event}`,
    initial_comment: `Here's the image for *${name}*! :tada:`,
  })
})
;(async () => {
  await app.start(process.env.PORT || 3000)
  console.log("Slack image bot is running!")
})()

That's the complete bot. About 50 lines of code, and half of that is Slack boilerplate.

Step 4 deployStep 4: Deploy

You need the bot running somewhere publicly accessible. Good free or cheap options:

  • Railway: Free tier, deploys from GitHub
  • Render: Free tier for web services
  • Vercel: Works with serverless functions
  • Any VPS: A $5/month Hetzner or DigitalOcean server

Once deployed, update the Slack slash command Request URL to your server's URL.

Step 5 test itStep 5: Test It

In any Slack channel, type:

/generate Sarah - 5 Year Anniversary

The bot should respond in about 3 seconds with a branded celebration image.

Advanced multiple templatesAdvanced: Multiple Templates

Most teams need more than one type of image. Handle this with sub-commands:

app.command("/image", async ({ command, ack, client }) => {
  await ack()
 
  const [subCommand, ...rest] = command.text.split(" ")
  const data = rest.join(" ")
 
  const templates = {
    celebrate: process.env.TEMPLATE_CELEBRATE,
    report: process.env.TEMPLATE_REPORT,
    social: process.env.TEMPLATE_SOCIAL,
    quote: process.env.TEMPLATE_QUOTE,
  }
 
  const templateId = templates[subCommand]
 
  if (!templateId) {
    await client.chat.postEphemeral({
      channel: command.channel_id,
      user: command.user_id,
      text: `Available commands: ${Object.keys(templates).join(", ")}`,
    })
    return
  }
 
  // Parse data based on sub-command type and generate...
})

Now your team can use:

  • /image celebrate Sarah - 5 Years
  • /image report Revenue: $45K, Users: 1,200
  • /image quote "Innovation is..." - Steve Jobs

No code alternativeNo-Code Alternative

Don't want to write a bot? Use Make.com or n8n with Slack triggers:

  1. Trigger: Slack "New Message in Channel" (watch for messages starting with a keyword)
  2. Parse: Extract the text after the keyword
  3. Generate: HTTP request to Imejis.io API
  4. Reply: Post the image back to Slack via the Slack module

This takes about an hour to set up and doesn't require any hosting. I'd recommend this approach if you don't want to maintain a server.

What about automatic triggersWhat About Automatic Triggers?

The slash command approach is manual (someone types a command). But you can also trigger image generation automatically:

New customer signup: Your backend sends a webhook to the bot when someone signs up. The bot generates a "New Customer!" card and posts to #sales.

Weekly metrics: A cron job runs every Friday at 5pm, pulls metrics from your database, generates a report card, and posts to #team.

GitHub release: When a new version is tagged, the bot generates a release announcement graphic and posts to #engineering.

These just replace the slash command trigger with a webhook or scheduled event. The image generation logic stays the same.

CostCost

ComponentMonthly Cost
Imejis.io (100 images)$0 (free tier)
Imejis.io (1,000 images)$14.99
Slack APIFree
Hosting (Railway/Render free tier)$0
Total for most teams$0

Most internal Slack bots generate fewer than 100 images per month. The Imejis.io free tier covers that completely.

Getting startedGetting Started

  1. Sign up for Imejis.io and create a template for your first use case
  2. Create a Slack app at api.slack.com/apps
  3. Copy the code above and customize the parsing logic
  4. Deploy to Railway or Render (free tier)
  5. Test in Slack and share with your team

The whole build takes about 2-3 hours. Most of that is Slack app configuration, not code. Want to build a similar bot for Discord? See our Discord Bot Image Generation tutorial.

For the JSON data format details, see our Generate Images from JSON guide. For bulk generation workflows, check Batch Image Generation from CSV. And for API pricing, see our Image Generation API Pricing Comparison.

FaqFAQ

Can a slack bot generate imagesCan a Slack bot generate images?

Yes. The bot listens for commands, calls Imejis.io with the data, and posts the image back to the channel. Round-trip is about 3 seconds.

What can i use a slack image bot forWhat can I use a Slack image bot for?

Team celebrations, weekly reports, customer notifications, social media drafts, event announcements, and quote graphics. Anything your team generates repeatedly.

Do i need my own server for a slack botDo I need my own server for a Slack bot?

Not necessarily. Railway and Render have free tiers. For no-code, a Make.com workflow with a Slack trigger works without hosting.

How much does this cost to runHow much does this cost to run?

$0 for most teams. Imejis.io free tier (100 images/month), Slack API (free), and serverless hosting (free tier). You won't pay unless you generate more than 100 images monthly.

How long does it take to buildHow long does it take to build?

About 2-3 hours. Most time goes to Slack app setup. The image generation part is ~10 lines of code.

Build something your team will actually useBuild Something Your Team Will Actually Use

Most internal tools gather dust. A Slack bot that generates images on command gets used because it meets people where they already work. If you're new to image APIs, start with our How to Generate Images with an API guide, then come back here. Try Imejis.io free and build yours this afternoon.