Adding Member to Discord Role from a Form. [400] Invalid Form Body

Hello everyone

I connected incoming form data via webhook to the Discord Module.

The task is to take the discord Username e.g. YAYJAY#7373 and add it to a Role.

I get an error. [400] Invalid Form Body

Any help appreciated, thanks

Hi @Leadio ,

Which Discord module do you use exactly?

Glenn - Callinetic

1 Like

Thanks for your reply

The Add a Role to a Guild Member

I think the issue is that I am sending in the User Name and not the Discord ID.
I have since learned that the Discord ID is a unique number

whereas the username is vanity and can be changed at any time.


My form is for a community server and we collect the Username, not the Discord ID.
It seems I need to find a way to either look up the Discord ID from the Username and then feed that into the Add Member module or I need to collect the Discord ID on the form.

The latter is harder cause its kind of hidden and most people don’t know how to find it so it requires user instruction while they fill out the form.

According to the Discord documentation, you indeed need the ID of the user and not the combination of username#discriminator. Discord Developer Portal
I assume this is causing the issue.

To resolve this issue, you have the following option:
Look up the Discord ID from the username using the List Guild Members module and then feed that into the Add a Role to a Guild Member module. You can create a map() function to parse the ID of the respective user.

Hope this helps you.

Glenn - Callinetic

1 Like

Thanks again for confirming. I haven’t figured it out yet.
My webhook bring in the data as username#discriminator.
The List Guild Members returns the data like “82483471108276224 | Toby” concatenating the Discord ID and the username, without the discriminator.

Any ideas on how I parse down my data to just the username left of the # and then match that to the Used ID that is coming back from the List Guild Members

Is that even possible?

Hey there !
I’ve got the same problem but, with many test, I found something that work, for now !

I ask the user tag or username to the member of my communities with a google form. Your webhooks does the same, I imagine ?

So, what I did was to get the variables in the list guild member, and make a string, and with this string ( the username + the discriminator ), compare it to the username I get in my form with a filter. THEN I take the user ID from the variable whose been compared. :sweat_smile:

Written, that make no sens.
But it work ! :stuck_out_tongue:

Here my scenario, the filter and my setting:

Don’t forget to get the role of the bot ( yours or/and the integromat/make bot ) on your discord server at the top of the list of the roles, to be sure to not get a 403 error for the permission.

I’m super aware that it’s not perfect and I take any advices or suggestions :yellow_heart:


Hey @Aimee_D

Thank you so much, I am going to try and follow this approach tomorrow.
You are also a crypto community?

Hope will work for you, @Leadio :crossed_fingers:
And nope, not at all ! I’m in the gamification process for a online challenge for my creative community.

1 Like

The error message “Invalid Form Body” typically indicates that there is an issue with the format or structure of the data you are sending in your request to add a member to a Discord role from a form. Here are a few potential causes and solutions to consider:

  1. Verify Request Format: Double-check that the request body you are sending in your form submission matches the expected format for adding a member to a Discord role. Ensure you are using the correct field names and values required by the Discord API.
  2. Field Validation: Validate the form fields before submitting the request to ensure they contain the appropriate data. Make sure you are providing the necessary information, such as the member’s Discord ID or username, and the role ID or name.
  3. API Rate Limits: Take into account the rate limits set by the Discord API. If you are making too many requests within a short period, you may encounter this error. Consider adding rate limiting measures or spacing out your requests to comply with the API’s guidelines.
  4. Error Handling: Implement proper error handling in your form submission code to capture and display any specific error messages returned by the Discord API. This can help identify the exact issue causing the “Invalid Form Body” error.

If you are still experiencing difficulties, it may be helpful to review the official Discord API documentation or seek assistance from the Discord developer community for more specific guidance related to your implementation.