In this tutorial, you will be useing Google Apps Script and fBuilder to setup "automatically sent message notifications" to a Telegram Group (and/or an Email address) every time a person submits your Google Form
Before things get started, receive the Telegram Chat ID of the group you want to have response messages sent by adding "Get My ID (tg bot)" to a Telegram Group (remove the bot after receiving the Chat ID), and make sure "Pinponboy (tg bot)" is a member of that group
via https://drive.google.com/ or https://docs.google.com/forms/
Make sure to have a question where the respondent has to fill in their email.
- Remember to Rename the project
Webhook Script example:
var POST_URL = "https://webhook.ypcloud.com/form";
function onSubmit(e) {
var form = FormApp.getActiveForm();
var allResponses = form.getResponses();
var qFormName = form.getTitle();
var qFormTitle = DriveApp.getFileById(form.getId()).getName();
var timestamp = new Date().getTime();
var date = new Date(timestamp);
var formattedTime = (date.getDate()+
"/"+(date.getMonth()+1)+
"/"+date.getFullYear()+
" "+(date.getHours()+1)+
":"+date.getMinutes()+
":"+date.getSeconds());
var sReplyNum = FormApp.getActiveForm().getResponses().length;
var latestResponse = allResponses[allResponses.length - 1];
var response = latestResponse.getItemResponses();
var content = {
"qFormId":"HR-FORM-002",
"qBot":"exbot",
"qTgId":"-452345851",
"qFormName":qFormName,
"qFormTitle":qFormTitle,
"qBcc":"",
"sReplyDate": formattedTime,
"sReplyNum": sReplyNum,
"uName":response[0].getResponse(),
"uEmail":response[1].getResponse(),
"uTime":response[2].getResponse(),
"uResume":response[3].getResponse(),
"uNote":response[4].getResponse()
};
var options = {
"method": "post",
"contentType": "application/json",
"payload": JSON.stringify(content)
};
UrlFetchApp.fetch(POST_URL, options);
};
- qFormId: Replace BW with your initials, modify 01 as necessary
- qbot: Replace with your bot name
- qTgID: Replace with the Chat ID of the Telegram group you want form responses to be sent to
- qBcc: Add any emails you want responses
- Responses: Change the names and response number based on your form questions
Click "Save" after editing
Go to the "Triggers" page
Click "Add Trigger"
In the dropdown menu for "Select event type", select "On form submit", then click "Save"
Accept Apps Scripts authorization requests
Close the Apps Script
Login https://run.ypcloud.com, choose "fBuilder", click "Go"
Create a new project
Project Name, Title and QName (name of your Bot)
6. Import formbot-coffee.flow
- Edit the funtion node of the
reg
as the comment node shows - Click "Done", then "Deploy" to save your changes
- Edit the
to email
function nodes: modifymsg.payload
(following"content"
) according to responses in your Google Form's webhook script
-
Find and click on
q11/qbix/dc
in the left sidebar -
Click on "Info"
-
Find your Bot from the list
-
Copy the mma in the first column (It should look like:
q11/qbix/qx-yourname-3asdfghj-yourbotname-app
) -
Paste it back to the
reg
function node like the comment node shows -
Deploy and QRun to q11 again
After QRun, fill in a Google form and test whether the responses will be sent to your Telegram Group or Email