Skip to content

feat: make webhook display name suffix configurable#1257

Open
ornariece wants to merge 2 commits into
matrix-org:mainfrom
ornariece:configurable-webhook-displayname
Open

feat: make webhook display name suffix configurable#1257
ornariece wants to merge 2 commits into
matrix-org:mainfrom
ornariece:configurable-webhook-displayname

Conversation

@ornariece
Copy link
Copy Markdown

Summary

Adds a generic.displaynameSuffix config option to control the suffix appended to webhook virtual user display names. Defaults to " (Webhook)" for full backward compatibility.

Motivation

When using generic webhooks in a dedicated room per source (e.g., a monitoring room that receives alerts from one system), the hardcoded (Webhook) suffix in the display name adds no useful information and clutters the UI — especially on mobile clients like Element X where the sender name is shown prominently in push notifications.

Setting displaynameSuffix: "" allows the connection name (e.g., "PVE", "TrueNAS") to be used as-is as the virtual user's display name, which is cleaner when the name already identifies the source.

In multi-source rooms, operators can set a custom suffix like " [alert]" or keep the default.

Changes

  • src/config/sections/GenericHooks.ts: Added displaynameSuffix to the YAML config interface and class, defaulting to " (Webhook)"
  • src/Connections/GenericHook.ts: Updated ensureDisplayname() to use the configurable suffix instead of the hardcoded string. Added displaynameSuffix to GenericHookServiceConfig

Example config

generic:
  enabled: true
  urlPrefix: https://example.com/hookshot/webhooks/webhook
  userIdPrefix: _webhooks_
  displaynameSuffix: ""  # connection name used as-is

Testing

Tested with hookshot 7.3.2 base. Verified:

  • Default behavior unchanged (suffix = " (Webhook)" when not configured)
  • Empty string produces clean display names matching the connection name
  • Custom suffix strings work as expected

@ornariece ornariece requested a review from a team as a code owner April 7, 2026 12:00
Add `generic.displaynameSuffix` config option to control the suffix
appended to webhook virtual user display names. Defaults to " (Webhook)"
for backward compatibility.

Setting it to an empty string uses the connection name as-is, which is
useful when webhook connections are named after their source system
(e.g., "PVE", "TrueNAS") and the suffix adds no value.

Fixes the hardcoded `${name} (Webhook)` pattern in
GenericHookConnection.ensureDisplayname().
@ornariece ornariece force-pushed the configurable-webhook-displayname branch from d060092 to dfe1ed9 Compare April 7, 2026 12:03
Copy link
Copy Markdown
Contributor

@Half-Shot Half-Shot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

Copy link
Copy Markdown
Contributor

@Half-Shot Half-Shot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah, went too early. A few CI failures to clean up

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

Successfully merging this pull request may close these issues.

2 participants