Post to Telegram from Google Forms with Document Studio
Document Studio enables you to automatically post messages to your Telegram Groups and Channels from data in Google Forms.
This tutorial describes how to automatically post Google Form responses to a Telegram channel. If you would like to post to a group, see this tutorial on sending messages to a Telegram group from Google Sheets.
Register your Telegram Bot
Open BotFather inside the Telegram app and click the Start
button. Type /newbot
and follow the on-screen instructions to create a new bot.
Telegram will provide a secret API token that we'll need at a later step.
Add Bot to Telegram Channel
Open your Telegram Channel and tap the top bar where its name is displayed. Under the Members
section, tap on Administrators > Add Admin and search for your bot name. Bot can only publish to Telegram Channel where they have administrator privileges.
This step should be completed on Telegram's mobile app since not all Telegram features are available on the web or desktop.
Connect Telegram to Google Forms
Install Document Studio and open your Google Form to launch the add-on.
Inside the Document Studio app, provide a name for your workflow and, for this example, skip the Conditions page.
Next, choose Telegram
from the list of available tasks.
Make a Telegram message template
Inside the Telegram task, paste the bot API token and click Verify
to get a list of Telegram channels where the bot has access to post messages.
You can use dynamic fields, enclosed in double curly braces, in the message body. For instance, if you are asking for the name of the respondent in your Google Form, you can personalize the Telegram messages with variables like {{Your Name}}
.
Telegram Bots also support Scriptlets to add conditional text in the message body.
{% if {{Age}} > 18 or {{Age}} == 18 %}
{{Name}} can vote in the elections
{% endif %}
Preview and Save
Click the Preview
button and you should see a test message in Telegram. Document Studio will take the data from the second row of the response Google Sheet and publish the message to your selected Telegram Channel. Click Done
to locally apply your changes.
On the trigger screen, turn on the option that says Run workflow on Form Submit
and then click on the Save
button.
The workflow will now appear in the workflow dashboard where you can edit, delete or manually run the workflow.