Discord is a well-liked on the spot messaging and group-chatting platform, utilized by thousands and thousands of individuals. Notably, it has gained important traction inside schools and gaming communities. This tutorial reveals how one can routinely publish Google Type responses to a particular Discord channel with the assistance of Document Studio.
Ship Google Type Responses to Discord
Think about a school Discord server with devoted #tech and #science channels for various societies. Pupil volunteers can fill in a Google Type and point out which society they want be part of. When the respondent submits the Google Type, an on the spot notification is distributed to the respective Discord channel.
To get began, go to the Discord channel the place the Google Type notifications ought to be delivered and click on the Settings icon to repeat the webhook URL for that channel.
Now that you’ve generated the Discord webhook URL, go to your Google Type and create a new workflow in Doc Studio. On the Situations tab, specify the situation Most well-liked Society Precisely Match Tech Society
since we need to notify a unique Discord channel for every society.
On the Duties tab, add the Discord process and add the webhook URL that you simply’ve generated within the earlier step. For the message physique, you need to use any query title from the Google Type and these will likely be changed with precise customers submitted by the Google Type respondent.
Save the workflow and also you’ll routinely obtain notifications in Discord when the shape is submitted.
Ship to Discord with Apps Script
If you’re curious to understand how these messages are posted to Discord from Google Varieties, the reply is Google Apps Script.
The script will remodel the Google Type response right into a JSON message after which make an HTTP POST request to the webhook URL to publish a message to the Discord channel.
Right here’s a simplified snippet of the script:
const postMessageToDiscord = (formData) => {
var discordUrl = 'https://discordapp.com/api/webhooks/labnol/123';
var params = {
headers: {
'Content material-Kind': 'utility/x-www-form-urlencoded'
},
methodology: 'POST',
payload: JSON.stringify({ content material: formData }),
muteHttpExceptions: true
};
var response = UrlFetchApp.fetch(discordUrl, params);
Logger.log(response.getContentText());
};
Additionally see: Send Google Forms to Slack