You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
Have my module send the webhook
- What is the issue? Include screenshots / videos if possible!
The module is unable to send the webhook, even though it passes the pcall and no errors are in console.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
pcall, retyped everyting to ensure no typos, DevHub
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Hello DevForum,
For some reason, the following code works fine:
Http:PostAsync(game:GetService("ServerStorage"):GetAttribute("ADMINCI_WH_URL_MAIN"),
Http:JSONEncode({
username = "AdminCI debug",
embeds = {
{
title = "Debug message",
description = "This is AdminCI debug content, sent through a manual Http post at <t:" .. os.time() .. ">.",
footer = {
text = "Copyright (c) Quackoramic. All rights reserved."
},
color = dub
}
}
}),
Enum.HttpContentType.ApplicationJson,
false
)
But the following code does not:
local service = {}
function service:send(username, title, description, color)
local Http = game:GetService("HttpService")
local red = 16731469
local gre = 5898061
local blu = 5086719
local dub = 15132390
local success, response = pcall(function()
Http:PostAsync(game:GetService("ServerStorage"):GetAttribute("ADMINCI_WH_URL_MAIN"),
Http:JSONEncode({
username = username,
embeds = {
{
title = title,
description = description,
footer = {
text = "Copyright (c) Quackoramic. All rights reserved."
},
color = color
}
}
})
)
end)
if success then
warn("Request successful")
print(response) -- This will contain the response from the server
else
warn("Error: " .. response) -- This will contain the error message
end
end
return service
-- webhook:send("AdminCI debug 2", "Debug message 2", "This is AdminCI debug content 2, sent through WebhookService at <t:" .. os.time() .. ">.", "dub")
The bottom line of the code is what I am running to attempt to send the webhook.
Yes, the first one works, so the issue is not my webhook URL. I am so confused…
Also, I am definitely calling the ModuleScript right, I can guarantee that.
I hope that someone can figure out why I can’t
Thank you in advance,
Swiss