How would you get Webhooks to send a Discord message every time someone buys your group's clothing? Is this possible?

The title’s a bit long-winded but that’s what I’m wondering, would it be possible to get a Discord message every time clothing is bought from my group?

I don’t mean from in a game either, just whenever someone buys from the group.

Just to provide some slightly unnecessary code for this, here’s the Webhook script:

local HS = game:GetService("HttpService")
local Remotes = game:GetService("ReplicatedStorage").Remotes
local WebhookURL = "https://discord.com/api/webhooks/(url stuff)"

local Debounce = false

Remotes.WebhookFeedback.Event:Connect(function(purpose, playerName, details)
	if Debounce == false then
		Debounce = true
		local MessageData = {
			-- i'm not putting all of this stuff in, you get the gist of it
		}
		HS:PostAsync(WebhookURL , MessageData)
		wait(2)
		Debounce = false
	end
end)

While we’re still on the topic, what about whenever a player leaves/joins a group? My group’s small so if a webhook was sent every time someone joined it wouldn’t overload, but if it were to get big then I could just send a message every 2 or so hours saying how many joined/left.

Any feedback/help would be appreciated!

2 Likes

Make an API request to https://economy.roblox.com/v2/groups/{GROUP_ID}/transactions?limit=25&sortOrder=Asc&transactionType=Sale&cursor={CURSOR} with a roblox security cookie that is authorized to view this page. So create an account and give that bot permissions to view sales.

It returns a JSON array. You could then check the JSON array for new values, which would represent new sales.

3 Likes

At the moment you cannot use a webhook for Discord as Cloudflare is blocking Roblox requests to Discord. You’re gonna have to resort to using a proxy to push webhook requests through. We’re not sure if the block is permanent or not.

1 Like