jufdnhf
(jufdnhf)
1
Hello.
I’m using this webhook with discord, and I just cannot find why it’s not working. I get an HTTP 400 error code, if you didn’t know. Here is the code.
local data =
{
["content"] = "",
["embeds"] = {{
["title"] = "Report",
["color"] = 0xFF0000,
["fields"] = {
{
["name"] = "User",
["value"] = user.Name
},
{
["name"] = "Reason",
["value"] = reason
},
{
["name"] = "Server Id",
["value"] = jobid
}
},
["thumbnail"] = {
["url"] = thumbnail
}
}}
}
data = http:JSONEncode(data)
http:PostAsync("hidden", data)
Any help would be appreciated.
1 Like
Synitx
(Synitx)
2
Enable HTTPS Request in game settings.
2 Likes
jufdnhf
(jufdnhf)
3
HTTPS is already enabled, it’s something to do with the data but I cannot find what.
1 Like
Synitx
(Synitx)
4
Can you show me the whole code? some variables are missin and make sure your webhook url is correct.
2 Likes
Synitx
(Synitx)
5
Or, if you want we can talk on discord?
1 Like
jufdnhf
(jufdnhf)
6
local jobid = game.JobId
local data =
{
["content"] = "",
["embeds"] = {{
["title"] = "Report",
["color"] = 0xFF0000,
["fields"] = {
{
["name"] = "User",
["value"] = user.Name
},
{
["name"] = "Reason",
["value"] = reason
},
{
["name"] = "Server Id",
["value"] = jobid
}
}
}}
}
data = http:JSONEncode(data)
http:PostAsync("hidden", data)
1 Like
jufdnhf
(jufdnhf)
7
Also, reason and user and defined somewhere else, I know it’s not causing the problem though.
Synitx
(Synitx)
8
try:
local jobid = game.JobId
local data =
{
["content"] = "",
["embeds"] = {{
["title"] = "Report",
["color"] = 0xFF0000,
["fields"] = {
{
["name"] = "User",
["value"] = user.Name
},
{
["name"] = "Reason",
["value"] = reason
},
{
["name"] = "Server Id",
["value"] = jobid
}
}
}}
}
local toPost = http:JSONEncode(data)
http:PostAsync("hidden", toPost )
1 Like
jufdnhf
(jufdnhf)
9
Actually, sorry I just solved it. One of my variables were wrong.
Synitx
(Synitx)
10
Oh alrighty! have a gr8 day! or night!
1 Like
jufdnhf
(jufdnhf)
11
Thank you very much!! Much appreciated.
1 Like