Skip to main content
Skip table of contents

How-To: Execute A Workflow From A Google Sheet (using a webhook trigger)

Step 1: Set up your workflow

If your workflow begins with pulling data from a google sheet, make sure to reference the Google Sheets - Download Sheet to Workflows documentation, and ensure you’ve followed the steps to share your sheet with your Alli client’s Service Account.

You can also check out our popular workflow guides for inspiration like Popular Workflow: Google Sheet > Slack or check out our overview for a tutorial on how to use Workflows.

Step 2: Add a Webhook Trigger

  1. In your workflow, open Triggers on the left side navigation.

  2. Click Add Webhook.

  3. Copy the webhook URL.

    • Treat this URL like a password. Anyone with access can trigger the workflow via POST.

    • If compromised, delete or regenerate the webhook. Old URLs will no longer work.

For more details, see How-To: Add & Manage Webhook Triggers.

Step 3: Create your Google Apps Script

  1. In Google Sheets, click Extensions > Apps Script.

  2. Rename the project for clarity.

  3. Replace the default function with the code below.

    1. Update WEBHOOK_URL with your webhook.

  4. Click Save on the top

CODE
function sendWebhook() {
  var url = "WEBHOOK_URL";

  // Make POST request
  var response = UrlFetchApp.fetch(url, {
    method: "post",
    muteHttpExceptions: true
  });

  // Status code
  Logger.log(response.getResponseCode());

  // JSON response
  var json = JSON.parse(response.getContentText());
  Logger.log(json);
}

Step 4: Create A Button to Initiate Your Script

  1. In Google Sheets, click Insert > Drawing.

  2. Design a button (shape, color, text).

  3. Click Save & Close.

  4. Select the button → More (⋮) > Assign Script.

    • Enter your function name from the above script. In the above example, our function is called sendWebhook, so we would place that in the input box.

  5. Click OK.

Done! Now, clicking the button will trigger your workflow.

Tips:

  • The button is sensitive—accidental clicks will trigger it.

  • To move the button without triggering, right-click to bring up the resize handles (blue dots).

  • Place the button on a low-traffic tab (or its own sheet) to avoid unintended runs.

For a (longer) full overview, you can view this video:

https://zoom.us/clips/share/cUWd--3yQJmchwN3BUawFA

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.