/** * Bound Google Docs Apps Script example, checked 30 October 2026. * In Project Settings > Script properties, set MAKE_WEBHOOK_URL to your * own Make custom webhook URL. People who can edit the script can read it. * Sends only the current document ID. It does not change document sharing. */ function onOpen() { DocumentApp.getUi().createMenu('Custom Actions') .addItem('Submit Document', 'postDocumentIDToWebhook').addToUi(); } function postDocumentIDToWebhook() { const ui = DocumentApp.getUi(); const webhookUrl = PropertiesService.getScriptProperties() .getProperty('MAKE_WEBHOOK_URL'); if (!webhookUrl || !webhookUrl.startsWith('https://')) { ui.alert('Set MAKE_WEBHOOK_URL to your HTTPS Make webhook URL in Script properties first.'); return; } try { const documentId = DocumentApp.getActiveDocument().getId(); const response = UrlFetchApp.fetch(webhookUrl, { method: 'post', contentType: 'application/json', payload: JSON.stringify({ documentId: documentId }), muteHttpExceptions: true, followRedirects: false, }); const status = response.getResponseCode(); if (status >= 200 && status < 300) { ui.alert('The webhook accepted the request (HTTP ' + status + '). Check Make execution history to confirm the later steps completed.'); } else { ui.alert('The webhook returned HTTP ' + status + '. Check the URL, request format and Make execution history before trying again.'); } } catch (error) { ui.alert('The request could not be completed. Check your Apps Script permissions and execution log before trying again.'); } }