A small, self-hostable web app: a form, gated behind Sign in with Slack, that logs each submission to a Google Sheet and rings a Slack channel with a formatted notification.
Built with Astro (SSR) + Tailwind, and deployed on
Cloudflare — so all server code runs on the Web platform (Web Crypto, fetch),
with no Node-only dependencies. It's plain Astro: no UI framework, just a small
client <script> for the form's interactivity.
Sheetbell is the open-source flavor of an internal "log a conversation" tool. The defaults reflect a lightweight CRM workflow (a
Conversationslog + anEligiblecontact roster), but every sheet name, column, channel, and threshold is configurable, so you can repurpose it for any "form → sheet → Slack" use case.
- Slack sign-in gate — the form and its submit endpoint require signing in with Slack. (By default this accepts any Slack account that completes sign-in; restricting to your own workspace is a small code change — see the docs.)
- Appends to a Google Sheet — each submission becomes a new row in a
Conversationstab (timestamp, organizer, contact, date, message). - Slack notifications — a Block Kit message announces each submission; follow-ups are threaded under it.
- Optional contact reconciliation — looks up the submitted contact in an
Eligibletab using exact, substring, token, and fuzzy (Levenshtein) matching, then stamps "last engagement" and "notes" columns. - Tiny workflow engine — the form/Slack/Sheets pipeline is a declarative
workflow (trigger → steps with
{{ }}templating). Run it from the form or a webhook (/api/hooks/<slug>), view it at/flows, and add steps/integrations by editing data. A baby n8n. See docs. - Built-in hardening — same-origin CORS, per-IP rate limiting, request-size cap, strict input validation, and security headers.
| Concern | Choice |
|---|---|
| Framework | Astro 6 (output: "server") |
| UI | Astro components + Tailwind v4 (no UI framework) |
| Host / runtime | Cloudflare adapter (Workers-style, Web Crypto) |
| Auth | Slack OAuth → HMAC-signed JWT in an HttpOnly cookie |
| Data | Google Sheets API v4 (service account, RS256 JWT) |
The full docs (overview, getting started, configuration, how it works, deploy) live
in src/pages/docs/. They're served two ways:
- In the app at
/docswhen it's running. - As a static site on GitHub Pages: https://artmsilva.github.io/sheetbell/
(published by
.github/workflows/pages.yml).
To build the docs site locally:
mkdir -p .pages-src/pages && cp -R src/pages/docs .pages-src/pages/docs \
&& cp -R src/layouts .pages-src/layouts && cp src/index.css .pages-src/index.css
PAGES_BASE=/sheetbell npx astro build --config astro.pages.mjs # output in dist-pages/This repo ships with tooling so an AI assistant can help you set up, run, and extend it:
- AGENTS.md — orientation for any AI agent (architecture, runtime constraints, config model, conventions). CLAUDE.md points Claude Code at it.
- Slash commands (
.claude/commands/):/setup,/verify-setup,/deploy-check,/add-field. - Agent (
.claude/agents/):setup-doctor— diagnoses why things aren't working. - Skills (
.claude/skills/): step-by-step Slack-app and Google-Sheets setup. - Prompts (
prompts/): copy-paste prompts for common tasks.
New here? In Claude Code, just run /setup. Otherwise, paste the "Set it up with me"
prompt from prompts/README.md.
- Node.js 22 (see
.nvmrc) - A Slack workspace where you can create an app
- A Google Cloud project with the Sheets API enabled
- A Google Sheet you control
npm install
cp .env.example .env # then fill it in (see below)At https://api.slack.com/apps → Create New App:
- OAuth & Permissions → Redirect URLs: add
https://<your-origin>/api/auth/callback(for local dev this ishttps://localhost:4321/api/auth/callback). - User Token Scopes: add
identity.basic(used to identify the signed-in user). - Bot Token Scopes: add
chat:write(used to post notifications). - Install the app to your workspace, then copy:
- Client ID →
SLACK_CLIENT_ID - Client Secret →
SLACK_CLIENT_SECRET - Bot User OAuth Token (
xoxb-…) →SLACK_OAUTH
- Client ID →
- Invite the bot to your target channel(s):
/invite @YourApp. Use the channel IDs (e.g.C0123ABCD, found in the channel's "Get channel details") forSLACK_CHANNEL_ID/SLACK_CHANNEL_ID_TEST.
- In Google Cloud Console, enable the Google Sheets API.
- Create a service account and generate a JSON key.
- Put the entire JSON (single line) in
GOOGLE_SERVICE_KEY. - Share your spreadsheet with the service account's
client_email(give it Editor access). This step is required — without it the API returns permission errors.
Put the spreadsheet ID (the long token in its URL) in SPREADSHEET_ID.
Conversationstab — the append target. Rows are written as columns A–E:Timestamp · Organizer · Contact · Date · Message. A header row is recommended.Eligibletab (optional) — a contact roster. Column A holds contact names; the header row must include the columns named byELIGIBLE_ENGAGEMENT_COLUMNandELIGIBLE_NOTES_COLUMN. If you don't need this feature, just omit the tab — the lookup is skipped when no match is found.
npm run devThe dev server runs over HTTPS (via @vitejs/plugin-basic-ssl) because Slack
OAuth requires it. Accept the self-signed certificate warning in your browser.
Secrets and IDs are read at runtime from the environment.
| Variable | Required | Default | Purpose |
|---|---|---|---|
SLACK_CLIENT_ID |
✅ | — | Slack OAuth client ID |
SLACK_CLIENT_SECRET |
✅ | — | Slack OAuth secret; also the session-signing key |
SLACK_OAUTH |
✅ | — | Bot token (xoxb-…) for posting messages |
GOOGLE_SERVICE_KEY |
✅ | — | Service-account JSON (single line) |
SPREADSHEET_ID |
✅ | — | Target spreadsheet (production) |
SLACK_CHANNEL_ID |
✅ | — | Target channel (production) |
SPREADSHEET_ID_TEST |
— | falls back to SPREADSHEET_ID |
Spreadsheet used when not in production |
SLACK_CHANNEL_ID_TEST |
— | falls back to SLACK_CHANNEL_ID |
Channel used when not in production |
APP_NAME |
— | Sheetbell |
Brand shown in the navbar |
SHEET_TAB_CONVERSATIONS |
— | Conversations |
Tab to append submissions to |
SHEET_TAB_ELIGIBLE |
— | Eligible |
Tab to reconcile contacts against |
ELIGIBLE_ENGAGEMENT_COLUMN |
— | Last engagement / who did it |
Header of the column to stamp with engagement |
ELIGIBLE_NOTES_COLUMN |
— | Last Conversation Notes |
Header of the column to write notes into |
MATCH_SIMILARITY_THRESHOLD |
— | 0.7 |
Fuzzy-match cutoff (0–1) for contact reconciliation |
The app picks production vs. test targets from a PROD flag, which is true when
CF_PAGES === "1", MODE === "production", or Astro's import.meta.env.PROD is set.
This project uses @astrojs/cloudflare. Build with npm run build and deploy the
output with your Cloudflare Pages/Workers workflow. Set all required variables as
environment variables (and secrets for the sensitive ones — SLACK_CLIENT_SECRET,
SLACK_OAUTH, GOOGLE_SERVICE_KEY). Remember to add the deployed origin's
/api/auth/callback URL to your Slack app's redirect URLs.
src/middleware.jsgates the form page/(redirect to Slack sign-in) and the/api/submitendpoint (401 without a session)./docsis public.src/lib/auth.jsmints and verifies an HMAC-signed session token (Web Crypto), stored in an HttpOnly,SameSite=Lax,Securecookie. Note: the signing key isSLACK_CLIENT_SECRET, so rotating that value logs everyone out.src/lib/config.jsbuilds all runtime configuration from environment variables (viaastro:env/server, so it works the same locally and in production).src/pages/api/submit.jsvalidates input, writes to Sheets, and posts to Slack.
Full setup and walkthrough live in the docs site under /docs (start with
/docs/getting-started).