Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Discord webhooking make easy!


    Recommended Posts

    The easiest and only webhook class youll EVER need in your life!

    package org.dreambot.utilities;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.nio.charset.StandardCharsets;
    import java.util.Random;
    import static org.dreambot.api.utilities.Logger.log;
    public class Webhooks {
        private static final String WEBHOOK_URL = "YOUR WEBHOOK HERE, CHANGE THIS"; 
        public static void sendToWebhook(String title, String playerName, String amount, String totalCoin, String imageUrl) {
            if (playerName == null || playerName.isEmpty()) {
                log("PlayerName is invalid: " + playerName);
            if (amount == null || amount.isEmpty()) {
                log("Amount is invalid: " + amount);
            if (totalCoin == null || totalCoin.isEmpty()) {
                log("TotalCoin is invalid: " + totalCoin);
            if (imageUrl == null || imageUrl.isEmpty()) {
                log("Image URL is invalid: " + imageUrl);
            Random random = new Random();
            int color = random.nextInt(0xFFFFFF + 1);
            String jsonPayload = String.format("{\n" +
                    "  \"content\": \"_ _\",\n" +
                    "  \"embeds\": [\n" +
                    "    {\n" +
                    "      \"title\": \"%s\",\n" +
                    "      \"description\": \"\",\n" +
                    "      \"fields\": [\n" +
                    "        {\n" +
                    "          \"name\": \"Player Name\",\n" +
                    "          \"value\": \"%s\"\n" +
                    "        },\n" +
                    "        {\n" +
                    "          \"name\": \"Amount\",\n" +
                    "          \"value\": \"%s\"\n" +
                    "        },\n" +
                    "        {\n" +
                    "          \"name\": \"Total Coin\",\n" +
                    "          \"value\": \"%s\"\n" +
                    "        }\n" +
                    "      ],\n" +
                    "      \"color\": %d,\n" +
                    "      \"image\": {\n" +
                    "        \"url\": \"%s\"\n" +
                    "      }\n" +
                    "    }\n" +
                    "  ],\n" +
                    "  \"attachments\": []\n" +
                    "}", title, playerName, amount, totalCoin, color, imageUrl);
            try {
                int code = getCode(jsonPayload);
                log("Response code: " + code);
            } catch (Exception e) {
                log("Error while sending webhook: " + e.getMessage());
        private static int getCode(String jsonPayload) throws IOException {
            URL url = new URL(WEBHOOK_URL);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestProperty("User-Agent", "Java-DiscordWebhook-Bot");
            connection.setRequestProperty("Content-Type", "application/json; utf-8");
            connection.setRequestProperty("Accept", "application/json");
            try (OutputStream os = connection.getOutputStream()) {
                byte[] input = jsonPayload.getBytes(StandardCharsets.UTF_8);
                os.write(input, 0, input.length);
            return connection.getResponseCode();

    With this class, you can utilize the method for webhooking in an extremely simple way
    Webhook example:

    sendToWebhook("TITLE GOES HERE", "", "", "", "");

    To simplify the webhook image you can make a global variable for this. I personally use TreeBranchFramework so I put the image in my API.

    This is a useful documentation on discords embed system. This is json, NOT embedbuilder. NO you cannot mention inside the embed. You must modify this to do so(I wont do it for you). Just change the names annd values to correspond with your project. Fields name will be bold, value will not be.

    Hope this helps anyone needing webhooks in their scripts! Here is an example image of what my mule looks like with this.
    This is a modified version of something @DumbRat691 sent me. ZkHkzb0.png.bbe6685869513764959b73688f974a33.png

    Link to comment
    Share on other sites

    1 minute ago, DumbRat691 said:

    pog, np

    Ty :P I wasnt gonna share the other classes I utilize for the other shit but this ones worthy of sharing.

    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.