From bdcb1934c00db407140c5444104b57201e3d430a Mon Sep 17 00:00:00 2001 From: Gabriel Jablonski Date: Thu, 13 Nov 2025 04:58:15 -0300 Subject: [PATCH] feat(webhooks): add name to webhook (#12641) ## Description When working with webhooks, it's easy to lose track of which URL is which. Adding a `name` (optional) column to the webhook model is a straight-forward solution to make it significantly easier to identify webhooks. ## Type of change - [x] New feature (non-breaking change which adds functionality) ## How Has This Been Tested? Model and controller specs, and also running in production over several months without any issues. | Before | After | | --- | --- | | image copy 3 | image | | image copy 2 | image copy | ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] Any dependent changes have been merged and published in downstream modules --- .../api/v1/accounts/webhooks_controller.rb | 2 +- .../dashboard/i18n/locale/en/integrations.json | 4 ++++ .../integrations/Webhooks/WebhookForm.vue | 14 ++++++++++++++ .../settings/integrations/Webhooks/WebhookRow.vue | 12 ++++++++++-- app/models/webhook.rb | 1 + .../v1/accounts/webhooks/_webhook.json.jbuilder | 1 + db/migrate/20251010143218_add_name_to_webhooks.rb | 5 +++++ db/schema.rb | 1 + .../api/v1/accounts/webhook_controller_spec.rb | 15 +++++++++++++-- spec/factories/webhooks.rb | 1 + .../request/webhooks/create_update_payload.yml | 3 +++ swagger/definitions/resource/webhook.yml | 3 +++ swagger/swagger.json | 8 ++++++++ swagger/tag_groups/application_swagger.json | 8 ++++++++ swagger/tag_groups/client_swagger.json | 8 ++++++++ swagger/tag_groups/other_swagger.json | 8 ++++++++ swagger/tag_groups/platform_swagger.json | 8 ++++++++ 17 files changed, 97 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20251010143218_add_name_to_webhooks.rb diff --git a/app/controllers/api/v1/accounts/webhooks_controller.rb b/app/controllers/api/v1/accounts/webhooks_controller.rb index 7ea257ed2..9f8e94821 100644 --- a/app/controllers/api/v1/accounts/webhooks_controller.rb +++ b/app/controllers/api/v1/accounts/webhooks_controller.rb @@ -23,7 +23,7 @@ class Api::V1::Accounts::WebhooksController < Api::V1::Accounts::BaseController private def webhook_params - params.require(:webhook).permit(:inbox_id, :url, subscriptions: []) + params.require(:webhook).permit(:inbox_id, :name, :url, subscriptions: []) end def fetch_webhook diff --git a/app/javascript/dashboard/i18n/locale/en/integrations.json b/app/javascript/dashboard/i18n/locale/en/integrations.json index 78804220d..f74e674d7 100644 --- a/app/javascript/dashboard/i18n/locale/en/integrations.json +++ b/app/javascript/dashboard/i18n/locale/en/integrations.json @@ -46,6 +46,10 @@ "CONVERSATION_TYPING_OFF": "Conversation Typing Off" } }, + "NAME": { + "LABEL": "Webhook Name", + "PLACEHOLDER": "Enter the name of the webhook" + }, "END_POINT": { "LABEL": "Webhook URL", "PLACEHOLDER": "Example: {webhookExampleURL}", diff --git a/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/WebhookForm.vue b/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/WebhookForm.vue index 430658329..3f4b31299 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/WebhookForm.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/WebhookForm.vue @@ -55,6 +55,7 @@ export default { data() { return { url: this.value.url || '', + name: this.value.name || '', subscriptions: this.value.subscriptions || [], supportedWebhookEvents: SUPPORTED_WEBHOOK_EVENTS, }; @@ -68,11 +69,15 @@ export default { } ); }, + webhookNameInputPlaceholder() { + return this.$t('INTEGRATION_SETTINGS.WEBHOOK.FORM.NAME.PLACEHOLDER'); + }, }, methods: { onSubmit() { this.$emit('submit', { url: this.url, + name: this.name, subscriptions: this.subscriptions, }); }, @@ -97,6 +102,15 @@ export default { {{ $t('INTEGRATION_SETTINGS.WEBHOOK.FORM.END_POINT.ERROR') }} + diff --git a/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/WebhookRow.vue b/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/WebhookRow.vue index e2bf986e0..3dfb177e5 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/WebhookRow.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/WebhookRow.vue @@ -37,8 +37,16 @@ const subscribedEvents = computed(() => {