R
Railwayβ€’13mo ago
Yomyam

Control webhook event

is it possible to control discord webhook event to discord? like i just want to make me send only status SUCCESS
Solution:
You could probably make it go through a proxy first like have it point to your server, let it recceive it, and then let your server send a new webhook to discord based off of the original...
Jump to solution
8 Replies
Solution
Fragly
Fraglyβ€’13mo ago
You could probably make it go through a proxy first like have it point to your server, let it recceive it, and then let your server send a new webhook to discord based off of the original
Yomyam
YomyamOPβ€’13mo ago
so i need to handling webhook by myself right? check type is SUCCESS and send self-implement discord embed to guild
No description
Fragly
Fraglyβ€’13mo ago
ya
Yomyam
YomyamOPβ€’13mo ago
alright tysm!
Fragly
Fraglyβ€’13mo ago
GoodJob to help
lilliiiillil
lilliiiillilβ€’12mo ago
Hello @Fragly, do you mind sharing your solution? I'd like to filter events sent on my Discord channel as well πŸ˜ƒ Mb I meant to tag @NightKunGz γƒ…
Yomyam
YomyamOPβ€’12mo ago
actually i don't implement yet sadspengebob
lilliiiillil
lilliiiillilβ€’12mo ago
Okay for anyone wondering it's actually as simple as that using JS & Express
import express from "express";
import cors from "cors";

const WEBHOOK_URL = process.env.WEBHOOK_URL
const SERVICE_URL = process.env.SERVICE_URL

const port = process.env.PORT || 3000;
const app = express();
app.use(cors());
app.use(express.json());

app.get("/", (req, res) => {
res.send("Hello World!");
});

app.post("/", async (req, res) => {
const body = req.body;
if (body.type !== "CRASHED") {
res.send("OK");
return;
}

fetch(WEBHOOK_URL, {
body: JSON.stringify({
content: `Crashed \n\n${SERVICE_URL}`,
}),
headers: {
"Content-Type": "application/json",
},
method: "POST",
}).then(() => {
res.send("OK");
});
});

app.listen(port, () => {
console.log("Server listening on port " + port);
});
import express from "express";
import cors from "cors";

const WEBHOOK_URL = process.env.WEBHOOK_URL
const SERVICE_URL = process.env.SERVICE_URL

const port = process.env.PORT || 3000;
const app = express();
app.use(cors());
app.use(express.json());

app.get("/", (req, res) => {
res.send("Hello World!");
});

app.post("/", async (req, res) => {
const body = req.body;
if (body.type !== "CRASHED") {
res.send("OK");
return;
}

fetch(WEBHOOK_URL, {
body: JSON.stringify({
content: `Crashed \n\n${SERVICE_URL}`,
}),
headers: {
"Content-Type": "application/json",
},
method: "POST",
}).then(() => {
res.send("OK");
});
});

app.listen(port, () => {
console.log("Server listening on port " + port);
});
Want results from more Discord servers?
Add your server