HTML form to send data to Discord webhook

I’m currently attempting to build an HTML form to send data to a channel on my Discord server. I’m using a webhook as it seems to be the best method available.

I can send data to the channel using Postman or cURL, but I cannot seem to figure out how to send the data via the HTML form.

Here is the HTML form code

<form target="_blank" title="Test form - Fill out in entirety." enctype="multipart/form-data" method="post" action="https://discordapp.com/api/webhooks/{webhook.id}/{webhook.token}">     <div class="form-group"><small class="form-text text-muted">Your name</small><input type="text" class="form-control" name="username" placeholder="Name" required /></div>     <div class="form-group"><small class="form-text text-muted">Today's Date.</small><input class="form-control" type="date" required /></div>     <div class="form-group"><small class="form-text text-muted">Your Content</small><textarea class="form-control" required></textarea></div>     <div class="form-group"><button class="btn btn-outline-secondary btn-block" type="submit">Submit Form</button></div> </form> 

According to the documentation, it supports form data bodies, if encoded properly, and I believe my encoding is correct. However, upon submission, it returns {"message": "Cannot send an empty message", "code": 50006} from the endpoint.

What am I doing wrong here? Am I misreading the documentation to begin with?

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.