Tutorial - How to send a message from Roblox to Discord (webhooks)

Hello everyone! I kind of got a bit bored so I thought that I could share some information with you all. A very efficient way to get information form Roblox > Discord will be here- step by step.

Step 1 - Create the webhook :incoming_envelope:
To create a Webhook, it’s simple. Go to the channel you want the information to appear inand click the Edit Channel button.
image

Once you get to the settings, go to the Intergations category, and create a brand new webhook. You can rename it, change the icon, and whatever. Next, make sure you copy the ID. We’ll need that later.

image

Step 2 - Coding. :scroll:
Now we get to go to the fun part- coding. Make sure you follow this and read carefully, as doing something wrong here could break the code.

First, we need to enable HTTP services. Once in your game, go to settings, and go to the Security tab. Next, ensure that HTTP services are on, so the switch should be green.
image image

image

Next, we need to create our script. Add a script in ServerScriptService. Or, if you were to already have a server sided script with that information, you can just ignore adding the script and just put the code in your current script.

Now, we have to script. You should have a way that the information gets to this script- if you don’t, please make that. If you cannot make it, then this tutorial isn’t for you and I suggest finding a more specific tutorial on YouTube. Make sure the information is easily accessible in the format found below.

local httpService = game:GetService("HttpService")
local webhookUrl = "PutYourWebhookHere"
local data = {
    ['content'] = "putWhatYouWantOnTheMessageHere", --Only if you want something on a plain message put it here.
    ['embeds'] = { --Only put this table if you want an embed.
        {
            ['title'] = "embedTitleHere", --Put nothing in quotes if you don't want a title.
            ['description'] = "embedDescriptionHere",--Put nothing in quotes if you don't want a description.
            ['color'] = Color3.new(pickAcolor), --Don't add this if you want the basic color.
            ['footer'] = { --Don't add this table if you don't want anything on the footer.
                ['text'] = "putWhatTextYouWantOnYourFooterHere"
            },
            ['fields'] = { --If you don't understand fields or don't know what they are, don't put this here.
                {
		    ["name"] = "titleGoesHere",
		    ["value"] = "whateverTextYouWantGoesHere",
		    ["inline"] = true --If you don't know what this if you can leave it out.
                },
            },
        }
    }
}
httpService:PostAsync(webhookUrl,httpService:JSONEncode(data))

After this, make sure you publish your game, and it should work!
Thanks for reading, I hope this helped!

If you have any issues, or questions, don’t hesitate to DM me on Discord: cam.#0771 or PM me.

5 Likes

Detailed my friend! Love it, great explanation too.

1 Like

This tutorial helped me a lot. Thanks! Also great job!

1 Like

This tutorial is very useful, it will help me in my game development!

1 Like

Thank you so much! It will be very useful.

1 Like

Hello,
I know im very late to this topic, however I was wondering if you can add authors to the embeds.

image

There is an example of what I would like to do (the top bit).

Becomes:

local data = {
    ['username'] = "MY USERNAME"
    ['content'] = "putWhatYouWantOnTheMessageHere", --Only if you want something on a plain message put it here.
    ['embeds'] = { --Only put this table if you want an embed.
        {
            ['title'] = "embedTitleHere", --Put nothing in quotes if you don't want a title.
            ['description'] = "embedDescriptionHere",--Put nothing in quotes if you don't want a description.
            ['color'] = Color3.new(pickAcolor), --Don't add this if you want the basic color.
            ['footer'] = { --Don't add this table if you don't want anything on the footer.
                ['text'] = "putWhatTextYouWantOnYourFooterHere"
            },
            ['fields'] = { --If you don't understand fields or don't know what they are, don't put this here.
                {
		    ["name"] = "titleGoesHere",
		    ["value"] = "whateverTextYouWantGoesHere",
		    ["inline"] = true --If you don't know what this if you can leave it out.
                },
            },
        }
    }
}

Hi,
Sorry my screenshot wasn’t very clear what I meant was how would I add an author name inside the embed like the example below,

Screen

You could try:

    ['embeds'] = { --Only put this table if you want an embed.
        { 
            ['author'] = {
             ['name'] = "Name",
             }
            ['title'] = "embedTitleHere", --Put nothing in quotes if you don't want a title.
            ['description'] = "embedDescriptionHere",--Put nothing in quotes if you don't want a description.
            ['color'] = Color3.new(pickAcolor), --Don't add this if you want the basic color.
            ['footer'] = { --Don't add this table if you don't want anything on the footer.
                ['text'] = "putWhatTextYouWantOnYourFooterHere"
            },
            ['fields'] = { --If you don't understand fields or don't know what they are, don't put this here.
                {
		    ["name"] = "titleGoesHere",
		    ["value"] = "whateverTextYouWantGoesHere",
		    ["inline"] = true --If you don't know what this if you can leave it out.
                },
            },
        }
    }

For url, just add ['url'] = "https://example.com" after line 4.

1 Like