feat(conversations): add opt-in merge for custom attributes (#15119)

Adds an opt-in merge flag to the conversation custom attributes endpoint
so integrations can update only the keys they send instead of replacing
the whole hash, matching how the contacts endpoint already behaves. Also
adds a destroy_custom_attributes endpoint to remove specific keys,
mirroring the contacts convention. Replace stays the default, so
existing integrations are unaffected.

How to test

POST /conversations/:id/custom_attributes com { "custom_attributes":
{"a":1} }, then { "custom_attributes": {"b":2}, "merge": true } results
in {a:1, b:2}; no merge, results in {b:2}.
POST /conversations/:id/destroy_custom_attributes with {
"custom_attributes": ["a"] } removes only a.

---------

Co-authored-by: Vishnu Narayanan <iamwishnu@gmail.com>
This commit is contained in:
enzogtrujillo
2026-07-28 04:13:56 -03:00
committed by GitHub
parent 3479b1026e
commit acae0a2acf
10 changed files with 318 additions and 5 deletions

View File

@@ -173,6 +173,7 @@ Rails.application.routes.draw do
post :update_last_seen
post :unread
post :custom_attributes
post :destroy_custom_attributes
get :attachments
get :inbox_assistant
get :reporting_events if ChatwootApp.enterprise?