Skip to content
Advertisement

How to correctly make Create DM request in Discord API?

I am trying to create dm

JavaScript

This code receives response with “400: Bad request” message. I’ve read this but I can’t find any examples of correct usage of this request.

Advertisement

Answer

I finally understood my mistake, I shouldn’t pass dictionary as data but should pass a str, so I changed data=data to data=json.dumps(data) and it worked

Advertisement