melmsie / dbl-webhook-handler

An express server for handling dbl webhooks made for optimal self hosting and ease.
1 stars 1 forks source link

Not working #3

Closed 3061LRTAGSPKJMORMRT closed 3 years ago

3061LRTAGSPKJMORMRT commented 3 years ago

Hi there! This is my code:

const http = require("http")
const express = require('express');
const app = express();
app.use(express.json({extended: false}))
app.post("/dblwebhook", async (req, res) => {
  if(req.headers.authorization) {
    if(req.headers.authorization === webhook_secret) {
      res.send({status: 200});
      console.log("test")
      console.log(req.body.id)
    } else {
      res.send({status: 401, error: 'The auth received does not match the one in your config file.'})
    }
  } else {
    res.send({status: 403, error: 'There was no auth header in the webhook'})
  }
})
http.createServer(app).listen(8126);

but when i test it, it doesn't log anything. This is the code for discordbotlist.com right? The webhook secret is correct

3061LRTAGSPKJMORMRT commented 3 years ago

Urgh i am sorry, the test webhook button wasn't working, but when i upvoted the bot, it worked. So so sorry for wasting your time