Post Google Forms Submissions to Slack with Google Scripts

Andy Chase has published a Google Script that will let you automatically post Google Form submissions to a Slack channel. You need to place the script inside the script editor of your Google Forms editor and associate the onSubmit() method with the Form Submit trigger.

// replace this with your own Slack webhook URL
// https://crowdscores.slack.com/services
var webhookUrl = "https://hooks.slack.com/services/****/****/****";

function onSubmit(e) {
  var response = e.response.getItemResponses();

  // Setup 2:
  // Modify the below to make the message you want.
  // See: https://developers.google.com/apps-script/reference/forms/form-response
  var d = e.response.getRespondentEmail() + " | " + response[0].getResponse();

  var payload = {
    payload: '{"text": "' + d + '"}',
  };

  var options = {
    method: "post",
    payload: payload,
  };

  UrlFetchApp.fetch(webhookUrl, options);
}

Amit Agarwal is a web geek, solo entrepreneur and loves making things on the Internet. Google recently awarded him the Google Developer Expert and Google Cloud Champion title for his work on Google Workspace and Google Apps Script.

Awards & Recognition

Google Developer Expert

Google Developer Expert

Google awarded us the Developer Expert title recogizing our work in Workspace

ProductHunt Golden Kitty

ProductHunt Golden Kitty

Our Gmail tool won the Lifehack of the Year award at ProductHunt Golden Kitty Awards

Microsoft MVP Alumni

Microsoft MVP Alumni

Microsoft awarded us the Most Valuable Professional title for 5 years in a row

Google Cloud Champion

Google Cloud Champion

Google awarded us the Champion Innovator award for technical expertise

Want to stay up to date?
Sign up for our email newsletter.

We will never send any spam emails. Promise 🫶🏻