"Trust check failed" error when sending message to discord

Hey! I am attempting to make a feedback system that sends a message to a channel in a Discord server when a user presses a button in game. I have my webhook set up and managed to send a message to the server via a server script. However I’m having trouble when sending a message to the server by pressing a text button.

What I am doing is firing a remote event from the client to the server that contains the link key thing for the webhook and then the message to send. Whenever I press the button, I get the error “Trust check failed.”

Here is my local script code: (in the text button)

local http = game:GetService("HttpService")
local Data = {
	["content"] = "Hey! This is a message sent from roblox!"
}

Data = http:JSONEncode(Data)

game:GetService("ReplicatedStorage").sendFb:FireServer("<webhook key>", Data)

My server script code:

local http = game:GetService("HttpService")

game:GetService("ReplicatedStorage").sendFb.OnServerEvent:Connect(key, data)
    http:PostAsync(key, data)
end)

Sorry if I made any typos, or misspelled anything. I rewrote my code from memory on a device, but I’m pretty positive I got it right.

UPDATE
image
I’m still getting the error despite changing the Discord link to the proxy version.

Are you sending directly to Discord’s url? Unless they’ve changed it recently, the Roblox user-agent is blocked by Discord because of continual rate limit abuse. You’ll have to use a proxy.

3 Likes

If you are sending the request directly to discord you need to use this Roblox Discord Webhook Proxy Server

1 Like

Well I did this from a serverscript and it worked:

local http = game:GetService("HttpService")
local Data = {
	["content"] = "This is a test message"
}

Data = http:JSONEncode(Data)

http:PostAsync("<key>", Data)

I’ll check it out.

On a slightly unrelated note. That is really bad remote security. Someone could easily spam the remote hundreds of times and get your web hook banned

1 Like

Unless they can read my button code, they wouldn’t be able to get the key though, right?

The only place that the key / link appears is in the button’s code.

Exploiters can get all the client code I.e don’t put your webhook id on the client

2 Likes

You’re needing Connect(function()

local http = game:GetService("HttpService")

game:GetService("ReplicatedStorage").sendFb.OnServerEvent:Connect(function(key, data)
    http:PostAsync(key, data)
end)

Oh yeah, I forgot that. That’s in the original code, I was rewriting this from memory.

Okay, I’ll sort that out once I get back to my computer.

is http requests allowed in game settings

Yes. The error I’m getting is “trust check failed”

Mind if we could talk on discord about it? Axolix#0001

Sure.

Did you test that script in studio? It’ll work in studio because it’s firing from your device, not a Roblox server.

Like other people have said, you have to use a proxy for it to work in an actual server.

You probably ran your code in studio (which has a different UserAgent than live roblox servers) which is probably why it worked. Discord blocked roblox’s UserAgent, not roblox studio’s user agent. You’ll definitely need to use a proxy.

I personally wouldn’t recommend a feedback system from Discord primarily because that’s grounds for potential misusage. There’s the issue of Roblox potentially cracking down on you if you do not filter messages sent to Discord, as well as Discord being unhappy with your use of webhooks.

Your remotes are also relatively insecure. The only thing the client should be sending is text input. The server should be validating (and filtering) text input from the client, then sending it over.

And, to parrot several other people who posted this repeatedly for whatever reason (seriously, only one person needs to say it…), you will need to use a proxy server if you wish to use Discord webhooks, as Roblox’s UserAgent is blocked. The one Quaration replied with should work just fine for your use case (assuming that’s discord.osyr.is, I didn’t check the post).

i get this error when website does not have ssl.

and also i suggest reading this topic it will help you Roblox Discord Webhook Proxy Server