Post Google Forms Responses to Discord Channels

Discord is a popular instant messaging and group-chatting platform, used by millions of people. Notably, it has gained significant traction within colleges and gaming communities. This tutorial shows how you can automatically post Google Form responses to a specific Discord channel with the help of Document Studio.

Google Forms to Discord Channel

Send Google Form Responses to Discord

Imagine a college Discord server with dedicated #tech and #science channels for different societies. Student volunteers can fill in a Google Form and indicate which society they would like be a part of. When the respondent submits the Google Form, an instant notification is sent to the respective Discord channel.

To get started, go to the Discord channel where the Google Form notifications should be delivered and click the Settings icon to copy the webhook URL for that channel.

Discord Webhook URL

Now that you have generated the Discord webhook URL, go to your Google Form and create a new workflow in Document Studio. On the Conditions tab, specify the condition Preferred Society Exactly Match Tech Society since we want to notify a different Discord channel for each society.

On the Tasks tab, add the Discord task and add the webhook URL that you’ve generated in the previous step. For the message body, you can use any question title from the Google Form and these will be replaced with actual users submitted by the Google Form respondent.

Save the workflow and you’ll automatically receive notifications in Discord when the form is submitted.

Google Forms to Discord Automation

Post to Discord with Apps Script

If you are curious to know how these messages are posted to Discord from Google Forms, the answer is Google Apps Script.

The script will transform the Google Form response into a JSON message and then make an HTTP POST request to the webhook URL to post a message to the Discord channel.

Here’s a simplified snippet of the script:

const postMessageToDiscord = (formData) => {

  var discordUrl = 'https://discordapp.com/api/webhooks/labnol/123';

  var params = {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
    method: 'POST',
    payload: JSON.stringify({ content: formData }),
    muteHttpExceptions: true,
  };

  var response = UrlFetchApp.fetch(discordUrl, params);

  Logger.log(response.getContentText());
}

Also see: Send Google Forms to Slack



source:https://ift.tt/c7eS0dQ

Comments

Popular posts from this blog

The 101 Most Useful Websites

Compare MacBook Prices Worldwide with Google Sheets

Interesting Websites to Visit When You’re Bored