Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webhooks, forbidden? #639

Open
KenwoodFox opened this issue Mar 13, 2024 · 6 comments
Open

Webhooks, forbidden? #639

KenwoodFox opened this issue Mar 13, 2024 · 6 comments

Comments

@KenwoodFox
Copy link

This might be silly but, im trying to get szurubooru to call a discord webhook using the webhook section in config, i get this in the logs though:

...
server-1  | [2024-03-13 16:45:01] szurubooru.func.net Unable to call webhook https://discord.com/api/webhooks/<id>/<secret>: HTTP Error 403: Forbidden
...

am i just being silly?
@hujle
Copy link
Contributor

hujle commented Mar 13, 2024

I think this is rather Discord issue than szurubooru's. This means Discord is blocking your server's connection to their API. I have the same issue with my instance and I tried to contact Discord support about it over a week ago. Got no response from them so far (which is kinda expected tbh, Discord support is full of shit).

@KenwoodFox
Copy link
Author

How can it tell my server apart from me? im sitting right next to it, 😕

@hujle
Copy link
Contributor

hujle commented Mar 13, 2024

...or, perhaps Discord doesn't like what szurubooru sends to their webhooks and blocking connection. It could be anything at this point.

@Theenoro
Copy link

What are you exactly trying to do?
Ok Webhook, but what Info do you need in particular? (like Uploads? new Users?)
You could need something like a service thingie which modifies/translates it and then send it to your original discord webhook url.

szurubooru -> service thingie -> discord webhook

I mean would be possible. Wrote last year a thingie to use szurubooru in a booru android app. Works like a charm, just needed to know what szurubooru sends and what the client expect to understand the response. Would be same here I suppose.

@hujle
Copy link
Contributor

hujle commented Mar 13, 2024

There is a webhook setting in ./server/config.yaml, line 66, and the expected behavior after inclusion of a webhook URL was simply a message appearing in Discord server's channel where the webhook was created. But instead, Discord API responds with HTTP Error: 403 Forbidden message.

Simple as that.

@Theenoro
Copy link

Started to create thingie which accepts the booru webhooks and transforms them into ones which discord could understand.
I mean I get from szurubooru

{
  "operation": "created",
  "type": "post",
  "id": 1,
  "user": {
    "name": "Test",
    "avatarUrl": "data/avatars/test.png"
  },
  "data": {
    "source": null,
    "safety": "unsafe",
    "checksum": "",
    "flags": [],
    "featured": false,
    "tags": [],
    "relations": [],
    "notes": []
  },
  "time": "2024-03-13T23:35:57.964435Z"
}

and discord wants something like

{
  "content": "Hello, World!",
  "embeds": [
    {
      "title": "Hello, Embed!",
      "description": "This is an embedded message."
    }
  ],
  "attachments": [
    {
      "id": 0,
      "description": "Image of a cute little cat",
      "filename": "myfilename.png"
    }
  ]
}

I would answer to the thing szurubooru sends also 403 cause its an unexpected input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants