Receiving HTTP Requests

I want to be able to receive HTTP requests, do some processing on the JSON and then post that to a discord channel. Are there any docs about receiving HTTP requests? I only saw the docs about calling an API. How would I be able to get my discord server to just wait on incoming requests, and only do an action when that request is received. Thanks!
7 Replies
d.js toolkit
d.js toolkit•10mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Unknown User
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
ggonick
ggonick•10mo ago
gotcha, i'm pretty familiar with express, but once I receieved a request with express what's the best way to forward that JSON to discord.js to trigger an action? also lmk if this question is off-topic and should be moved i don't want to break any rules 😭
Unknown User
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
ggonick
ggonick•10mo ago
would I have discord.js running in the same file as my express server then?
Unknown User
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
ggonick
ggonick•10mo ago
ahh that makes more sense, thanks! 😄 would this just be a webhook then? or still make a bot ig the reason i'm doing all this is because I'm currently sending out POST requests from a google app script, but it's difficult to do any data processing there so I thought it would be nice to send the JSON data to a node server where I could process everything there but if that is an option i'll definitely look into it gotcha sounds good, i'll try implementing this rn! thanks 😄 does this come with a server to receive the HTTP requests? or would I still be using express to do that