Discord Integration

Hiya, everyone!
I’ve seen a few people who have managed to make a make Discord Integration where it sends an embed saying that a user a has brought a gamepass with information like the gamepass name, the user who brought it and the price. How would I go about doing this, not asking someone to make the script.
If you want to contact me my discord tag is Myles.#0001

Webhook

3 Likes

Howdy :cowboy_hat_face:

This is done through Webhooks.

You can find some basic information how through this tutorial:

3 Likes

Not exactly what I’m looking for, but thanks for the help.

What @aerites posted is a great start and introduction, I can see you are looking for a more complex embed then just a message. Here is a snippet of code that will allow you to send embeds.

local HttpServ = game:GetService('HttpService')
local url = "https://discordapp.com/api/webhooks/***/****"

local data = 
	{
		["content"] = "",
		["embeds"] = {{
			["title"] = "__**Ultimate Title**__",
			["description"] = "blah blah",
			["type"] = "rich",
			["color"] = tonumber(0xffffff), — Color is in hex format
			["fields"] = {
				{
					["name"] = "__Title__",
					["value"] = "hi",
					["inline"] = true
				},
				{
					["name"] = "__Title__",
					["value"] = "hi",
					["inline"] = true
				}
			}
		}}
	} 

local newdata = HttpServ:JSONEncode(data)
	
	HttpServ:PostAsync(url, newdata)
2 Likes

Wdym not you’re looking for? Pretty sure that picture shown is using webhooks. Unless you want how to give the gamepass info too

1 Like

I may be wrong with this but I believe to get embedded messages you need a Discord Bot Account to be running the code and not just a webhook. The regular webhook system just posts messages in plain messages. Obviously getting a bot account to communicate to Roblox would require so extra work to be done. It would be much easier to just go with a simple webhook for this use.

You can embed a message with webhooks

No you are able to send post request from roblox using HTTP service, and webhooks are the only thing you need for this and they can send embeds just as a bit can.

1 Like

It is helpful but I’m not a programmer in any way so i still don’t know what to do even after reading, I hope that clears it up.

Oh, never have seen them post the method on the Discord Developer Portal for making webhooks. Thanks for showing me this. :smiley:

1 Like

I got recommended this visualizer when I didn’t know much about embeds and webhooks on roblox and it helped show what you can do and made it clearer on how to use embeds.

https://leovoel.github.io/embed-visualizer/

1 Like

As @desinied said this can be done via Webhooks.

local HttpServ = game:GetService('HttpService')
local url = "https://discordapp.com/api/webhooks/***/****"

local data = 
	{
		["content"] = "",
		["embeds"] = {{
			["title"] = "__**V1 / Rank Management Logs**__",
			["type"] = "rich",
			["color"] = tonumber(0xffffff), — Color is in hex format
			["fields"] = {
				{
					["name"] = "Rank Purchased:",
					["value"] = "Price", -- somehow get the price of the gamepass here
					["inline"] = false
				},
				{
					["name"] = "Player Info:",
					["value"] = "Username / ID",
					["inline"] = false
				}
{
					["name"] = "Current Rank:",
					["value"] = "Current Rank",
					["inline"] = false
				}
{
					["name"] = "Purchased Rank",
					["value"] = "Some rank they purchased",
					["inline"] = false
				}
			}
		}}
	} 

local newdata = HttpServ:JSONEncode(data)
	
	HttpServ:PostAsync(url, newdata)``` 

That would be an example, You would need to use some functions to get the Userids / gamepass info etc
2 Likes