DEV Community

I built a free contact form that delivers every message to Telegram - no Formspree, no monthly fee

Most small-business websites have one of two problems: no contact form at all, or a form that sends mail to an inbox nobody checks. The 2026 audit I keep coming back to found 22 of 50 small-business sites had no working form anywhere on the homepage.

The paid fixes are Formspree's paid plans and Typeform - fine products, but a monthly fee for what is, at heart, a very small job: take a message from a visitor and put it somewhere the owner actually looks. So I built the free version: lead-capture-to-telegram.

What it is

A drop-in contact / quote form for a small-business website. A visitor fills in name, phone, email (optional), a topic (general question, appointment, quote, feedback), a message, and optionally one photo - and the message lands in the owner's Telegram chat within seconds.

There is no backend server to run and no inbox to check. The owner already checks Telegram; now the website's messages are there too.

What is in the repo

  • index.html + styles.css + app.js - the demo page, pre-configured for a fictional café (Willow Café), so you can open it and try the whole flow in seconds.
  • snippet.html - the drop-in block. Copy it into any website, replace one WORKER_URL placeholder, done. It works without the other files.
  • worker.js + wrangler.toml - one Cloudflare Worker (free tier, no database, no KV) that validates the message and forwards it to Telegram through the Bot API.
  • README.md - the full setup guide, including the 10-minute Worker deploy.

The details that matter

Spam honeypot, not a CAPTCHA. There is a hidden website field that humans never see. Bots fill it; the Worker quietly accepts the message and drops it, so the bot cannot tell it was caught. No puzzle for a real visitor to solve.

Validation before sending. Name, phone, message length, and email format are checked inline, with a plain-language error under the field that fails. The submit button disables while a send is in progress, so a double-click cannot send the same message twice.

Demo mode is honest. With no Worker configured, the form still works end to end - but the success screen says so plainly ("Demo mode - nothing was sent") and shows the exact message that would have gone to Telegram. No silent fake success.

Photos work. Attach one image (max 10 MB) and the Worker forwards it with sendPhoto, the message as the caption - useful when a customer wants a quote for a repair and a photo says more than words.

How to turn it on (10 minutes)

  • Message @botfather in Telegram, /newbot, copy the token.
  • Send /start to your new bot, open https://api.telegram.org/bot<TOKEN>/getUpdates, copy the chat.id.
  • From the repo folder:
npx wrangler login
npx wrangler secret put BOT_TOKEN
npx wrangler secret put CHAT_ID
npx wrangler deploy
  • Paste the Worker URL into CONFIG.telegram.workerUrl in app.js and into WORKER_URL in snippet.html. Re-upload. Then lock it down by setting ALLOWED_ORIGIN in wrangler.toml to your site's origin.

The README has the full steps plus a curl test.

Honest limits

I put these in the README and I will repeat them here, because a tool that hides its limits is a tool you cannot trust:

  • No database. A message lives only in the owner's Telegram chat. Delete it there and it is gone - no inbox, search, or archive.
  • No email auto-reply. The success screen is the only confirmation the visitor gets.
  • The honeypot and the in-memory rate limit are best-effort, not bulletproof. A determined bot can still get through.
  • No auth on the Worker. Anyone who learns the Worker URL can POST to it, so restrict ALLOWED_ORIGIN and treat incoming messages as unverified until you confirm them by phone.
  • The Worker only forwards messages. It cannot answer them, book anything, or take payments.

Why this one

It is the same shelf I have been building all week: small, single-purpose, free tools that replace one paid subscription - the invoice generator, the QR toolkit, the booking page, the Telegram FAQ bot, the Claude skills pack. Each one is a repo you can read in full, a demo you can try without signing up, and a README that tells you what it cannot do.

If you run a small business and your contact form goes nowhere, try the demo and tell me what is missing. If you build sites for small businesses, the snippet is yours to reuse.

Repo: https://github.com/ViraBuilds/lead-capture-to-telegram
Demo: https://virabuilds.github.io/lead-capture-to-telegram/

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.