Integrations from Roblox to Discord

hdhdhdhdhdhdhdh

1 Like

I will try this, thank you all for your help!

(Oh and before I go, how would I make my own custom HTTP-POST with node.js so that I can run it via Roblox? I can’t find resources Oh god stackoverflow)

give me a second to look at my own code because i dont remember from heart

1 Like

ok got it

so express got its own get function its called post

so you will need to first listen to the website which is basically starting it then listen for the post

const express = require('express');
const bp = require('body-parser'); // this is used to extract your text from the request
const app = express();
const XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
const port = 8000; // this port is usually open

// you CANNOT change this; this is how discord wants it to be sent
// to use xml http request first you need to create a new request with 'let x = new XMLHttpRequest()'
// then you need to open to POST: this basically means set the method to POST 'request.open("POST", webhook-link'
// then you set the request header 'x.setRequestHeader("Content-Type", "application/json")'
// set the data in a json file 'var data = {content: body}'
// then send with a stringified json 'x.send(JSON.stringify(data)'
// everything above this is a simple downed version of my proxy. this only allows strings while mine allows embeds, etc
// everything above goes inside a function that you will call inside the post function

// activate your body parser
app.use(bp.text()); // without this you wont be able to get the text

app.post('/post', (request, response) => {
    // make sure to send back
    response.send("got POST");
    // parse the body, this is dependant on how you set it up, remember you are sending a string nothing else
    // what i do is split the body and figure out which one is the webhook link and which one is the body
    // then call the request function with the body and webhook link
})

// make sure to listen
app.listen(port, function() {
    // log something if you want you dont have to
    console.log('listening to server');
})

all of that (if done in replit) will automatically create a website and just use that link to post to on roblox

example roblox code:

local HttpService = game:GetService("HttpService")
local url = "url here"

-- case sensitive
local options = {
    Url = url.."/post",
    Method = "POST",
    Headers = {
        ["Content-Type"] = "text/plain"
    },
    Body = how ever you want to set your body up. this is what i do: Body .. " Webhook_Link=" .. webhook_link
}

local sucess, msg = pcall(function()
    local response = HttpService:RequestAsync(options)
    -- manage your response here
    return response.Success
end)

-- simple error catching
if not success then
    print(msg)
end

again this is all up to however you want to design it this is just how i did it

tell me if you got problems

1 Like

Is their anyway to call this request without using Roblox Studio? I wanna test if it works first.

wdym http service works both in studio and in game

No I mean like, anyway to test it off my chrome instead of on studio to see if it works? Studio takes a bit to test play wifi issues, so I wanna make sure it’s working.

you could make another javascript file using xmlhttprequest to send to the proxy using the same options as roblox and just run that and print the response

Okay, so the code would be https://replit.com/@user/WebLink//post ? I am not good with stuff like node.js lol-

not two slashes before post only one but yes

1 Like

I will test right now and see if theres any issues.

i have to go now so bye
asjkghajhksghakjsghag

1 Like

Cya, also it doesn’t seem to be working…

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.