Skip to content

Instantly share code, notes, and snippets.

@HirbodBehnam
Last active June 8, 2024 21:11
Show Gist options
  • Save HirbodBehnam/324437df2a295298fa7ec39ac547b5d7 to your computer and use it in GitHub Desktop.
Save HirbodBehnam/324437df2a295298fa7ec39ac547b5d7 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);
};
@atiyah1999
Copy link

atiyah1999 commented Dec 15, 2023

hello, I appreciate your work. Its really work fine on me. But when my respondenr upload some media like photo or video over G-form. The bot could read the media. Can you fix it? thanks

@chapimenge3
Copy link

Works like a charm.

@konkinm
Copy link

konkinm commented Jun 8, 2024

cool! thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment