Skip to content

Support for Discord Forum Channels (thread_id parameter) in Webhook Validation #203

@Kiosama04

Description

@Kiosama04

Description
Currently, it is impossible to use Discord Webhooks with Forum channels because the application's URL validation (Regex) does not allow query parameters. Discord requires a thread_id or thread_name when posting to a forum, but adding ?thread_id=... to the Webhook URL triggers an "Invalid Discord Webhook URL" error.

Error Log

{
  "message": "Webhooks posted to forum channels must have a thread_name or thread_id",
  "code": 220001
}

Proposed Fix
The tokenRegex in server/notifications/discord.js (and the corresponding JSON schema) should be updated to allow optional query parameters.

Current Regex:
/^https:\/\/(?:discord\.com|discordapp\.com)\/api\/webhooks\/[0-9]+\/[0-9a-zA-Z_.-]+$/

Suggested Regex:
/^https:\/\/(?:discord\.com|discordapp\.com)\/api\/webhooks\/[0-9]+\/[0-9a-zA-Z_.-]+(\?thread_id=[0-9]+)?$/

Steps to Reproduce

  1. Create a Webhook in a Discord Forum channel.
  2. Try to add the Webhook URL in Lunalytics with the thread parameter: https://discord.com/api/webhooks/ID/TOKEN?thread_id=12345.
  3. The UI prevents saving, or the backend returns a validation error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions