Tools
Google Forms, Apps Script, Telegram
Price
Free
Time
15 min
Level
Copy and paste, beginner

Handy for a quote request, a booking or a job application: you reply to the client while they are still at their screen. Why Telegram and not WhatsApp? Because a Telegram bot takes two minutes to create, whereas WhatsApp requires Meta's WhatsApp Business API, which is much heavier to set up.

Create your Telegram bot

  1. Talk to BotFatherIn Telegram, search for @BotFather (the official account, with the verified badge) and send /newbot. Give it a name, then a username ending in “bot”. BotFather replies with a token: that is your bot's password, keep it somewhere safe.
  2. Start the conversationOpen the chat with your new bot, tap “Start” and send it a message, for example “hello”.
  3. Find your chat IDIn your browser, open the address below, replacing YOUR_TOKEN. Look for "chat":{"id": followed by a number: that is your chat ID.
    Browser
    https://api.telegram.org/botYOUR_TOKEN/getUpdates
    To alert a whole team, add the bot to a Telegram group, post a message in the group and get the group's ID the same way.

Connect the form

  1. Open Apps Script from the formIn your Google Form editor, click the three-dot menu, then “Apps Script”. The script will be attached to this form.
  2. Store the token and the chat IDOn the left, “Project Settings”, then “Script Properties”. Add TELEGRAM_TOKEN (the BotFather token) and TELEGRAM_CHAT_ID (the number you found above), then save.
  3. Paste the scriptReplace the content of Code.gs with this code and save.
    Code.gs
    function sendToTelegram(e) {
      const props = PropertiesService.getScriptProperties();
      const token = props.getProperty('TELEGRAM_TOKEN');
      const chatId = props.getProperty('TELEGRAM_CHAT_ID');
    
      const lines = e.response.getItemResponses().map(function (r) {
        return r.getItem().getTitle() + ': ' + r.getResponse();
      });
      const text = ('New form response\n\n' + lines.join('\n')).slice(0, 4000);
    
      UrlFetchApp.fetch('https://api.telegram.org/bot' + token + '/sendMessage', {
        method: 'post',
        contentType: 'application/json',
        payload: JSON.stringify({ chat_id: chatId, text: text })
      });
    }
  4. Add the triggerOn the left, “Triggers” (the alarm clock icon), then “Add Trigger”. Choose the sendToTelegram function, the form as the event source and form submit as the event type. Save and authorise the script.
  5. Test itFill in your form as a client would. The message arrives on Telegram. Do not test with the editor's “Run” button: without a real response, the script has nothing to send and shows an error.

Good to know

  • Telegram caps a message at 4,096 characters: the script cuts at 4,000 for very long forms.
  • The trigger runs under your Google account. If you delete it or the form changes owner, create it again.
  • If something goes wrong, the “Executions” tab in Apps Script shows every run and any error.

Token and personal data. The token lets anyone control your bot: keep it in the script properties, never in the code. If it leaks, send /token to BotFather to generate a new one. Your clients' answers pass through Telegram: avoid sending sensitive data this way and mention it in the information you give to people filling in the form.

Sources

Want the request to land in your CRM too, with a quote drafted automatically? That is the kind of automation I set up.