How do I make a POST request to roblox using discord.js?

I recently made a discord bot and would like to know how I can integrate it to Roblox (beginner in web development).
Screenshot 2021-08-21 183456
what I’m trying to achieve
by RegisteredCode on Roblox

I’m using discord.js, node(ofc), nodemon, and visual studio code to make my bot. Is this possible while hosting the bot locally? If so, how can I also do it in the cloud

you can use HttpService to communicate with your discord bot

https://developer.roblox.com/en-us/api-reference/class/HttpService

Could you be more specific? I’ve heard of this service before but I’m not sure how exactly I’d use it in visual studio. (What URL would I use)

your discord bot should have a webhook that you can use as the url

Well, actually it’s impossible to make requests to the roblox servers. Only way to do that would be to have a website (preferably using express) and the bot would POST/PATCH/PUT data to the website. Later you would need to setup checks every x seconds (in the game) to the website (ex. Normally the data returned would be “{ riot: false }”, after triggering the command it would be “{ riot: true }”)

2 Likes

Goodie goodie, HTTP requests, my favorite.

You cannot send post requests directly to the Roblox servers, however, you can fire requests from the Roblox server to your project. Suppose you are hosting your bot on a DNS server, you would have to make a quick hello world website (preferably using express), copy the link, and fire HTTP requests using that endpoint. As far as I am aware, making post requests directly to the Roblox server can’t be done unless you have a 3rd party database set up for the Roblox server and discord.js script to read. Too much work if you ask me but if you wish, go for it.

1 Like