N1netails is an open-source project that provides practical alerts and monitoring for applications. Use the N1netails Discord Webhook Client to easily send webhook messages to a discord server.
Use the following documents to create a discord server and discord webhooks. N1ne Tails Discord Webhook Client will utilize the discord webhook to the target discord server.
https://support.discord.com/hc/en-us/articles/204849977-How-do-I-create-a-server
https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks
Install the discord webhook client by adding the following dependency:
<dependency>
<groupId>com.n1netails</groupId>
<artifactId>n1netails-discord-webhook-client</artifactId>
<version>0.3.0</version>
</dependency>Gradle (Groovy)
implementation 'com.n1netails:n1netails-discord-webhook-client:0.3.0'Here is how you can configure the project for different frameworks
Add the following beans to your spring boot application:
import com.n1netails.n1netails.discord.api.DiscordWebhookClient;
import com.n1netails.n1netails.discord.internal.DiscordWebhookClientImpl;
import com.n1netails.n1netails.discord.service.WebhookService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class DiscordWebhookConfig {
@Bean
public WebhookService webhookService() {
return new WebhookService();
}
@Bean
public DiscordWebhookClient discordWebhookClient(WebhookService service) {
return new DiscordWebhookClientImpl(service);
}
}import com.n1netails.n1netails.discord.internal.DiscordWebhookClientImpl;
import com.n1netails.n1netails.discord.service.WebhookService;
WebhookService service = new WebhookService();
DiscordWebhookClient client = new DiscordWebhookClientImpl(service);Discord webhook resource: https://discord.com/developers/docs/resources/webhook
import com.n1netails.n1netails.discord.api.DiscordWebhookClient;
import com.n1netails.n1netails.discord.internal.DiscordWebhookClientImpl;
import com.n1netails.n1netails.discord.service.WebhookService;
import com.n1netails.n1netails.discord.model.WebhookMessage;
public class ExampleService {
private final DiscordWebhookClient webhookClient;
public ExampleService() {
this.webhookClient = new DiscordWebhookClientImpl(new WebhookService());
}
public void webhookExample(String content) {
WebhookMessage message = new WebhookMessage(content);
// replace with your discord webhook url
String webhookUrl = "https://discord.com/api/webhooks/xxx/yyy";
webhookClient.sendMessage(webhookUrl, message);
}
}Includes embeds, fields, and action buttons.
import com.n1netails.n1netails.discord.DiscordColor;
import com.n1netails.n1netails.discord.api.DiscordWebhookClient;
import com.n1netails.n1netails.discord.model.*;
import java.util.Collections;
import java.time.Instant;
public class DetailedExample {
public void sendDetailedMessage(DiscordWebhookClient client, String webhookUrl) {
Embed.EmbedField field = new Embed.EmbedField();
field.setName("Environment");
field.setValue("Production");
field.setInline(true);
Embed embed = new EmbedBuilder()
.withTitle("System Update")
.withDescription("All systems are operational π")
.withColor(DiscordColor.GREEN.getValue())
.withFields(Collections.singletonList(field))
.withTimestamp(Instant.now().toString())
.build();
Component button = new ComponentBuilder()
.withType(Component.BUTTON)
.withStyle(Component.LINK)
.withLabel("View Dashboard")
.withUrl("https://n1netails.com/")
.build();
Component actionRow = new ComponentBuilder()
.withType(Component.ACTION_ROW)
.withComponents(Collections.singletonList(button))
.build();
WebhookMessage msg = new WebhookMessageBuilder()
.withUsername("Monitor Bot")
.withContent("Weekly report is ready!")
.withEmbeds(Collections.singletonList(embed))
.withComponents(Collections.singletonList(actionRow))
.build();
client.sendMessage(webhookUrl, msg);
}
}You can add images or GIFs via URL in the embed or as a message attachment.
import com.n1netails.n1netails.discord.model.*;
import java.util.Collections;
public class ImageGifExample {
public void sendMedia(DiscordWebhookClient client, String webhookUrl) {
// Image in Embed
String gifUrl = "https://media2.giphy.com/media/v1.Y2lkPTc5MGI3NjExc2czZjNjbWljd3lva3lvem15NjJoZHptbmR0Y2Z2eWRjaXYzMXF6cyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/xsE65jaPsUKUo/giphy.gif";
Embed.Image gif = new Embed.Image();
gif.setUrl(gifUrl);
Embed embed = new EmbedBuilder()
.withTitle("GIF Example")
.withImage(gif)
.build();
WebhookMessage msg = new WebhookMessageBuilder()
.withEmbeds(Collections.singletonList(embed))
.build();
client.sendMessage(webhookUrl, msg);
}
}Videos can be included via URL in the message content (Discord will embed it automatically) or as a file attachment.
import com.n1netails.n1netails.discord.model.*;
import java.util.Collections;
public class VideoExample {
public void sendVideo(DiscordWebhookClient client, String webhookUrl, byte[] videoData) {
// Video via URL in content
String videoUrl = "https://n1netails.nyc3.cdn.digitaloceanspaces.com/video_2026-02-11_18-16-07.mp4";
videoData = downloadToBytes(videoUrl);
// Video as file attachment
WebhookFile file = new WebhookFile("video_2026-02-11_18-16-07.mp4", videoData);
WebhookMessage msg = new WebhookMessageBuilder()
.withContent("New video uploaded!")
.withFiles(Collections.singletonList(file))
.build();
client.sendMessage(webhookUrl, msg);
}
}
public static byte[] downloadToBytes(String fileUrl) throws IOException {
URL url = new URL(fileUrl);
try (InputStream in = url.openStream();
ByteArrayOutputStream buffer = new ByteArrayOutputStream()) {
byte[] chunk = new byte[8192];
int bytesRead;
while ((bytesRead = in.read(chunk)) != -1) {
buffer.write(chunk, 0, bytesRead);
}
return buffer.toByteArray();
}
}Send customized webhooks by utilizing the n1netails Pojo's
WebhookMessagecontentusernameavatar_urlttsembedscomponentsfiles
Embedtitledescriptionurlcolorauthornameurlicon_url
fieldsnamevalueinline
footertexticon_url
imageurl
thumbnailurl
timestamp
Componenttypestylelabelemojiidnameanimated
custom_idurldisabledcomponents
WebhookFilefilenamedata
Build the project using the following command
mvn clean installUse the following doc to get setup with publishing to the maven central repository https://central.sonatype.org/register/central-portal/#publishing
Maven install using release profile.
mvn clean install -P releaseMaven deploy to the maven central repository
mvn deploy -P releaseGenerate keys
gpg --full-generate-keyList keys
gpg --list-secret-keys --keyid-format LONGExport
gpg --export-secret-keys --armor YOUR_KEY_ID > private.ascgpg --export --armor YOUR_KEY_ID > public.ascImport
gpg --import private.asc
gpg --import public.ascList packets (good for validating keys were exported correctly)
gpg --list-packets public.ascFor community users, open an issue on GitHub or Join our Discord
Please use the following guidelines for contributions CONTRIBUTING
Thanks to all the amazing people who contributed to N1netails Discord Webhook Client! π

