Why Telegram first
Telegram gives you a bot API with no per message cost and no template approval. For a small site, that means a form submission can reach a phone in about a second, for free, today. WhatsApp Business API is better for customer conversations, but it needs a business account and paid conversations before the first message.
If your team already lives in Telegram, this is the shortest path from "form submitted" to "someone replied".
Step 1: create the bot
Open Telegram, search for @BotFather, send /newbot, pick a display name and a username ending in bot. BotFather returns a token that looks like 123456789:AA.... Treat that token like a password. Anyone with the token can send messages as your bot.
Step 2: get the chat ID
Send any message to your new bot, then open:
https://api.telegram.org/bot<TOKEN>/getUpdates
Look for "chat":{"id":...}. For a private chat the ID is a positive number. For a group it starts with a minus sign, and you must add the bot to the group before the ID appears.
Common mistake: using the bot username instead of the numeric ID. The API only accepts the number.
Step 3: connect WordPress
Two fields matter: token and chat ID. Store both in WordPress options, never in JavaScript, never in a template file. Send a test message from the settings screen before you touch the form.
If you prefer code, the request is a single POST:
wp_remote_post( "https://api.telegram.org/bot{$token}/sendMessage", array(
'timeout' => 10,
'body' => array(
'chat_id' => $chat_id,
'text' => $message,
'parse_mode' => 'HTML',
),
) );
Step 4: format the message
Keep it short. Name, email, subject, and the first 300 characters of the message are enough for a phone screen. Full detail stays in the email copy that Contact Form 7 already sends.
Do not let user input break the formatting. If you use HTML parse mode, escape <, >, and & before sending, otherwise a visitor can inject tags and the message will fail to render.
Step 5: use the right hook
Contact Form 7 fires wpcf7_mail_sent after a successful send. Hook there, not on wpcf7_submit, so a blocked or failed submission does not trigger a false alert.
Four errors and fixes
- 401 Unauthorized. Token copied with a trailing space or a line break. Re-copy and save again.
- 400 Bad Request, chat not found. The bot was never started by the recipient, or the chat ID is wrong. Open the bot, press Start, then retry.
- 403 Forbidden from the host. Some hosts block outbound requests to
api.telegram.org. Ask support to allow it, or test withwp_remote_getand read the error. - Message arrives empty. The template lost its placeholders during an edit. Restore the default template and change one field at a time.
Security notes
- The token belongs in the database, restricted to administrators.
- Log the last 50 notifications so you can prove a message was sent when a client asks.
- Nothing about the form data needs to leave your server except the message to Telegram.
- If you uninstall the plugin, delete the token. A stale token is a live credential.
What this does not do
Telegram notifications tell your team. They do not reply to the visitor inside the website. If you need two way conversations, that is a different product, and it usually means WhatsApp Business API or a helpdesk.
Get the plugin
Relay Notify does steps 1 to 5 with a settings screen, a test button, and a 50 entry log. Free, GPLv2, no account needed: https://matakupanlabs.com/relay/#get