Discord Webhook not working #80934
Replies: 3 comments
-
I think the problem has to do with the appscript.json file in the project. Discord webhooks requires I made the changes to my code, but i have not been able to get my discord to receive the new message. |
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
I am trying to send a notification to discord using a webhook on good sheets. Whereas the script seems to be running fine and tests fine, no notifications are going through. The idea is, every time a new form is submitted, which is pushed to google sheets, discord will notify users in the designated webhooked channel.
function onEdit(e) {
// Check if the event object and range are defined
if (!e || !e.range) {
console.log("No event object or range found. Function must be triggered by an edit.");
return;
}
var discordUrl = "webhook example here";
const range = e.range;
var sheetname = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getName();
var message = sheetname + " " + range.getA1Notation() + " edited on " + new Date();
var payload = JSON.stringify({ content: message });
var params = {
method: "POST",
payload: payload,
muteHttpExceptions: true,
contentType: "application/json"
};
var response = UrlFetchApp.fetch(POST_URL, params);
}
Beta Was this translation helpful? Give feedback.
All reactions