I have used a lot of script codes but nothing really works. I already have the webhook created and followed multiple tutorials. I already created the Google Form. I just need a script code that can send the results to the channel.
Have you tried researching: What did you find?
I have already used this code. But it did not work. I seen someone create a new code in the replies I also used that one. It did work but it didn’t send the message in the channel.
Sorry, I didn’t see this till now! But yes I did research. I used youtube tutorials that I could find. I don’t know if I did it wrong or the code just didn’t work because all the tutorial scripts were old…
For the ones you tried did you manage to get errors?
Yes, I did get errors on every one.
Can you show me the tutorial you ended up using?
Try the one from 2022. Then is there a way to get errors from google automations?
So it’s working, but it’s kinda working, can you send all the code here using code tags?
const WEBHOOK_URL = 'https://discord.com/api/webhooks/...'
const COLOUR = 0xFFD400
const form = FormApp.getActiveForm()
const message = form.getItems()[0]
function handleSubmit ({ response }) {
const content = response.getResponseForItem(message).getResponse()
UrlFetchApp.fetch(WEBHOOK_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
payload: JSON.stringify({
content: '',
embeds: [
{
// author: {
// name: 'Anonymous',
// url: 'https://docs.google.com/forms/d/e/.../viewform'
// },
description: content,
color: COLOUR
}
],
allowed_mentions: {
parse: []
}
})
})
}
// https://developers.google.com/apps-script/guides/triggers/installable#managing_triggers_programmatically
/**
* Creates an installable trigger for when a user responds to the form.
*/
function createSubmitTrigger () {
// https://developers.google.com/apps-script/reference/script/form-trigger-builder#onformsubmit
ScriptApp.newTrigger('handleSubmit')
.forForm(form)
.onFormSubmit()
.create()
}
Can you put it in code tags please?
I edited the message! Is that better??
anyone there?? i still need help.
Is there any error logs for this?
Okay, what exactly are you trying to achieve?
I am trying to get a script code that works for the form to send the response in the discord channel.