I'm trying to figure out why this is throwing me a 400 on POST, this is inside of a submit event listener for a form on my website. The form itself works as expected and emails me the appropriate data, but this webhook integration is failing and I'm not sure why.
const webhookBody = {
embeds: [{
title: 'Contact Form Submitted',
fields: [
{ name: 'From:', value: nameForm.value },
{ name: 'Email:', value: emailForm.value },
{ name: 'Message:', value: messageForm.value }
]
}],
};
const webhookUrl = 'myWebhookURL';
fetch(webhookUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(webhookBody),
})
.then(data => console.log(webhookBody));
The console gives back the object, but the field values are returning as empty strings. Maybe this has something to do with it?