WebhookService - Send Discord webhooks with ease!

WebhookService

An easy to use Discord webhook wrapper
v1.0.0


Download on Roblox :inbox_tray:
Download on Github :link:
View Source :computer:


What is WebhookService?

WebhookService is a super simple object-oriented Discord webhook wrapper!

It gives developers an easier way to send webhooks by providing them with classes for embeds & webhook messages! Both are also fully type-checked so you don’t need to keep looking back at the documentation!

WebhookService is currently still in development so you may encounter some bugs!
It has not been tested on any other proxy besides for hooks.hyra.io.

WebhookService is licensed under the MIT License

How do I install WebhookService?

It is pretty simple to install WebhookService, all you need to do is either get the model on Roblox or download the file on Github!

Once you’ve gotten either of those, insert it into ServerScriptService & then you’re ready to start using it!

Scroll down for some usage examples & documentation :slight_smile:


Examples

Example usage of WebhookService

Below is some sample code which you can use for your webhooks!

local WebhookService = require(game:GetService("ServerScriptService"):WaitForChild("WebhookService")) --// Put the location of WebhookService here!
local WebhookURL = "https://hooks.hyra.io/api/webhooks/GUILD_ID/WEBHOOK_ID" --// Paste in your webhook but replace discord.com with hooks.hyra.io!

local Webhook = WebhookService:CreateWebhook() --// Initializing the webhook object
Webhook:SetMessage("This was sent using WebhookService!") --// Setting the webhook's message

local Embed = WebhookService:CreateEmbed() --// Create an embed object
Embed:SetTitle("Hey there!") --// Set the title of the embed
Embed:SetDescription("This is a cool embed!") --// Give the embed a description
Embed:AddField("Example Field","You can put something here!") --// Add a field!
Embed:SetColor(Color3.fromRGB(0, 162, 255)) --// Give it some color!
Embed:SetTimestamp() --// Make it show the current time!

Webhook:AddEmbed(Embed) --// Add the embed to your webhook message!

WebhookService:SendAsync(Webhook,WebhookURL) --// Send your webhook!
List of functions
WebhookService:SendAsync(WebhookObject : WebhookObject, WebhookURL : WebhookURL) --// Sends a message using the webhook object to the URL
WebhookService:CreateWebhook() -> WebhookObject --// Creates a webhook object
WebhookService:CreateEmbed() -> EmbedObject --// Creates a embed object

WebhookObject:SetMessage(Message : string) --// Sets the message content of the webhook
WebhookObject:SetAvatar(Avatar : string) --// Sets the avatar of the webhook
WebhookObject:SetUsername(Username : string) --// Sets the username of the webhook
WebhookObject:SetTTS(TTS : boolean) --// Sets whether text to speech is enabled for the webhook
WebhookObject:AddEmbed(Embed : EmbedObject) --// Adds an embed object to the webhook

EmbedObject:SetTitle(Title : string) --// Sets the title of the embed object
EmbedObject:SetDescription(Description : string) --// Sets the description of the embed object
EmbedObject:SetAuthor(Name : string, URL : string?, Icon : string?) --// Sets the author of the embed object
EmbedObject:SetColor(Color : Color3 ) --// Sets the color of the embed object (Color3)
EmbedObject:SetTimestamp(Timestamp : ISO8601 string | nil) --// Sets the timestamp of the embed object (defaults to DateTime.now())
EmbedObject:SetURL(URL : string) --// Sets the URL of the embed object
EmbedObject:SetFooter(Text : string, Icon: string?) --// Sets the footer of the embed object
EmbedObject:AddField(Name : string, Value : string, Inline : boolean?) --// Adds a field to the embed object

Credits

WebhookService was developed by @Starnamics

If you encounter any bugs, please send me a message or reply to this post!

hope you guys enjoy my monthly module release, i’ll think of another one to release next month hopefully

Thank you! :slight_smile:

25 Likes

Why is this better to use than WebhookProxy? It looks like about the same thing (not sure.) Also make a proper API reference rather than just creating a list of functions.

1 Like

He created a webhook wrapper, which has a completely different purpose from the post you linked.

It’s a pretty clear distinction if you read just the first few sentences of each post.

4 Likes

I was initially going to write a proper API reference but decided to instead just write a list of functions as they’re all pretty easy to understand & it was around 2 AM at the time of writing the post so I was pretty tired.

Attempted to use WebhookProxy and would always throw me a HTTP 403 (Forbidden) Error, this actually happened to work.

1 Like

Thank you, i’m going to be using this.

1 Like

WebhookService:194: attempt to index nil with ‘title’

Code:

Embed.SetTitle("Log")

I am posting for my friend

The SetTitle function requires you to use : when invoking it, so type Embed:SetTitle("Log") instead.

1 Like

Recently, every single webhook url I have tried has stopped working. So I scoured the devforums and after many hours I have found this. And this module has worked like a charm. You are a life saver, and this is a very underrated creation.

2 Likes

Thank you! :slightly_smiling_face:

How can I use the SetAvatar() because I’m confused on how to make it show the players headshot

Hey, SetAvatar() accepts a URL of an image, which you can get from a function in the Players service (not too sure which one specifically so have a look at the docs).

Yeah I know, the function you’re talking about is probably GetUserThumbnailAsync() but my question is: How does the URL for the SetAvatar() look like? What is it supposed to look like?

1 Like

Should just be a string containing the URL, for example; SetAvatar("https://example.com")

Is there any way to catch the response?