---
title: "Slack Bots on Sprites: OAuth is Easy Now"
description: "Building a Slack bot with OAuth usually requires setting up a server with a public URL, handling callbacks, storing tokens, and maintaining them across restarts. Sprites simplifies this by providing an internet-accessible environment with a persistent filesystem, eliminating the need for Ngrok or separate hosting. To create the bot, users initialize npm, install @slack/bolt and express, and build an OAuth handler for Slack’s callback that stores tokens to the filesystem. The bot is registered as a Sprite service with sprite-env services create , which enables auto-start on HTTP requests, automatic request routing to port 8080, and persistent registration across hibernations. When idle, the Sprite hibernates to save costs and wakes in under a second, and users can create a checkpoint snapshot for easy restoration."
---

# Slack Bots on Sprites: OAuth is Easy Now

[Fly.io](https://yomu.fyi/company/fly-io) · Nov 6, 2026

**Type:** Tutorial

## Summary

Building a Slack bot with OAuth usually requires setting up a server with a public URL, handling callbacks, storing tokens, and maintaining them across restarts. Sprites simplifies this by providing an internet-accessible environment with a persistent filesystem, eliminating the need for Ngrok or separate hosting. To create the bot, users initialize npm, install @slack/bolt and express, and build an OAuth handler for Slack’s callback that stores tokens to the filesystem. The bot is registered as a Sprite service with sprite-env services create , which enables auto-start on HTTP requests, automatic request routing to port 8080, and persistent registration across hibernations. When idle, the Sprite hibernates to save costs and wakes in under a second, and users can create a checkpoint snapshot for easy restoration.

## Context

Slack bots need OAuth, which demands a server with a public URL to handle callbacks, store tokens, and maintain them across restarts. Sprites provides an internet-accessible environment with a persistent filesystem, eliminating the need for separate hosting, Ngrok, or custom token storage.

## Approach / What changed

Create a Sprite environment, initialize npm and install @slack/bolt and express. Write a server.js using the Bolt framework to handle OAuth callbacks and store tokens in the filesystem. Register the bot as a Sprite service with sprite-env services create slack-bot --cmd node --args server.js --http-port 8080 . Update the Sprite URL to public with sprite url update --auth public . Set environment variables for Slack credentials. Install the bot via the generated install URL. Optionally create a checkpoint with sprite checkpoint create for easy recovery.

## Takeaways

- Sprites uses its own service manager instead of systemd, enabling auto-start on HTTP requests and persistent registration across restarts and hibernation.
- The sprite url update --auth public command provides a public URL for Slack’s OAuth redirect, removing the need for tools like Ngrok or manual SSL setup.
- A Sprite checkpoint captures a snapshot of the entire environment (code, filesystem, state), allowing restoration of a working bot after changes with sprite restore <checkpoint-id> .

## FAQ

### How does Sprites handle Slack OAuth callbacks?

Sprites provides a public URL via \`sprite url update --auth public\`. The service auto-routes incoming HTTP requests to the specified port (8080), so the bot server receives the callback. Tokens are stored in the persistent filesystem, and the service registration survives restarts.

### What happens when the bot is idle?

The Sprite hibernates when idle to reduce costs and wakes in under a second when Slack sends events or users visit the install URL. This eliminates paying for idle server time.

### How can I recover if I break my bot?

Create a checkpoint with \`sprite checkpoint create\` to snapshot the entire environment. If the bot breaks, run \`sprite restore <checkpoint-id>\` to revert to that exact state, including code, configuration, and tokens.

**Tags:** [Bots](https://yomu.fyi/topic/bots), [OAuth](https://yomu.fyi/topic/oauth), [Slack](https://yomu.fyi/topic/slack), [Sprites](https://yomu.fyi/topic/sprites)

- Source: [Fly.io](https://fly.io/blog/slack-bots-on-sprites)
- Source URL: https://fly.io/blog/slack-bots-on-sprites
- Ingested by Yomu: 2026-11-06T18:00:22.155Z

[Read original post](https://fly.io/blog/slack-bots-on-sprites)
