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
- Create a Webhook in a Discord Forum channel.
- Try to add the Webhook URL in Lunalytics with the thread parameter:
https://discord.com/api/webhooks/ID/TOKEN?thread_id=12345.
- The UI prevents saving, or the backend returns a validation error.
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_idorthread_namewhen 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
tokenRegexinserver/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
https://discord.com/api/webhooks/ID/TOKEN?thread_id=12345.