• Discord Webhooks
    2 replies, posted
I was recently playing around with discord webhooks and http.post, everything went smoothly however I cannot figure out embeds. Everything worked well when I completely ignored embeds and used content (see below) - it simply sent the message. http.Post("webhook", {username = "test", content = "test"}) I've looked through the discord API and this site but I still can't work it out. If someone already worked with this or is able to help me, I'd be extremely grateful. It may be super simple but I can't work it out regardless, I've tried sending a table with all the data but still failed. Thanks in advance for any help.
If you're using embeds you need to json encode it all and send the json as the "payload_json" key. local payload = { embeds = { { author = { name = "hello", }, description = "some description", fields = { { name = "line 1", value = "value 1", inline = true, }, { name = "line 2", value = "value 2", inline = true, }, }, thumbnail = { url = "someurl" } } } } http.Post("webhook", { payload_json = util.TableToJSON(payload) }, function(result) print("success",res) end, function(result) print("error",res) end)
Thank you so much!
Sorry, you need to Log In to post a reply to this thread.