Automation Trigger: Webhook with Google forms | Stackby

Automation Trigger: Webhook with Google forms

Bring Google form responses directly to Stackby

Step 1: Link Google Forms to Google Sheets

  1. Open your Google Form.

  2. Click on the “Responses” tab.

  3. Click the green Sheets icon to link your form to a Google Sheet.

  4. All new responses will now automatically populate the sheet.

Step 2: Create a Webhook in Stackby

  1. Go to Stackby and open the table you want to connect.

  2. Click on the Automation icon (top right).

  3. Click Create New Automation.

  4. Choose “Webhook Trigger” as your trigger type.

  5. Click “Generate Webhook URL” and copy it.

Step 3: Add Google apps script to send data to Stackby

  1. In your linked Google Sheet, click on:
    Extensions > Apps Script

  2. Delete any existing code and paste the following:
    function sendToStackby(e) {

      const url = "YOUR_STACKBY_WEBHOOK_URL"; // Replace with your webhook URL

      const sheet = e.source.getActiveSheet();

      const lastRow = sheet.getLastRow();

      const rowData = sheet.getRange(lastRow, 1, 1, sheet.getLastColumn()).getValues()[0];

      const payload = {

        "Name": rowData[0],      // Replace with actual Stackby column names

        "Email": rowData[1],

        "Message": rowData[2]

      };

    const options = {

        "method": "post",

        "contentType": "application/json",

        "payload": JSON.stringify(payload)

      };

    UrlFetchApp.fetch(url, options);

    }

Make sure the keys in payload match the column names in your Stackby table.

  1. Click Save (name it something like SendToStackby).

Step 4: Set Up a Trigger for Form Submissions

  1. In the Apps Script editor, click the Triggers icon on the left.

  2. Click + Add Trigger (bottom right).

  3. Configure:
    Function: sendToStackby

    Event Source: From spreadsheet

    Event Type: On form submit

  4. Click Save, and authorize the script when prompted.

Step 5: Test It Out!

  1. Submit a test response via your Google Form.

  2. Go to your Stackby table.

  3. You should see a new row automatically created with your form data.

Troubleshooting Tips

  1. Ensure your column names in Stackby match the JSON keys you're sending. 

  2. Check the execution logs in Apps Script if something doesn’t work.

  3. Double-check that your webhook URL is correct.

  4. Make sure the script is properly authorized to run.

Did this answer your question?
😞
😐
😁