Skip to content

Instantly share code, notes, and snippets.

@holoc285
Forked from HirbodBehnam/google-form-to-tg.gs
Created May 15, 2025 02:55
Show Gist options
  • Save holoc285/6b75d33bb94d30b5529319d5663d0276 to your computer and use it in GitHub Desktop.
Save holoc285/6b75d33bb94d30b5529319d5663d0276 to your computer and use it in GitHub Desktop.
A google script to send submitted form results to a telegram bot
// Inspired by https://github.com/Iku/Google-Forms-to-Discord
const BOT_API = "YOUT_BOT_API";
const CHAT_ID = "CHAT_ID";
function onSubmit(e) {
var form = FormApp.getActiveForm();
var allResponses = form.getResponses();
var latestResponse = allResponses[allResponses.length - 1];
var response = latestResponse.getItemResponses();
var result = "";
for (var i = 0; i < response.length; i++)
result += response[i].getItem().getTitle() + " : " + response[i].getResponse() + "\n";
var options = {
"method": "post",
"payload": {
'chat_id': CHAT_ID,
'text': result
}
};
UrlFetchApp.fetch("https://api.telegram.org/bot" + BOT_API + "/sendMessage", options);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment