diff --git a/app/views/api/v1/models/_contact.json.jbuilder b/app/views/api/v1/models/_contact.json.jbuilder index 4e998ddf1..809452a45 100644 --- a/app/views/api/v1/models/_contact.json.jbuilder +++ b/app/views/api/v1/models/_contact.json.jbuilder @@ -10,6 +10,7 @@ json.thumbnail resource.avatar_url json.custom_attributes resource.custom_attributes json.last_activity_at resource.last_activity_at.to_i if resource[:last_activity_at].present? json.created_at resource.created_at.to_i if resource[:created_at].present? +json.account_id resource.account_id # we only want to output contact inbox when its /contacts endpoints if defined?(with_contact_inboxes) && with_contact_inboxes.present? json.contact_inboxes do diff --git a/app/views/api/v1/models/_inbox.json.jbuilder b/app/views/api/v1/models/_inbox.json.jbuilder index 785ecefb0..ca5e0a01e 100644 --- a/app/views/api/v1/models/_inbox.json.jbuilder +++ b/app/views/api/v1/models/_inbox.json.jbuilder @@ -3,6 +3,7 @@ json.avatar_url resource.try(:avatar_url) json.channel_id resource.channel_id json.name resource.name json.channel_type resource.channel_type +json.account_id resource.account_id json.greeting_enabled resource.greeting_enabled json.greeting_message resource.greeting_message json.working_hours_enabled resource.working_hours_enabled diff --git a/app/views/api/v1/models/_inbox_slim.json.jbuilder b/app/views/api/v1/models/_inbox_slim.json.jbuilder index c47aabf30..c828e12a4 100644 --- a/app/views/api/v1/models/_inbox_slim.json.jbuilder +++ b/app/views/api/v1/models/_inbox_slim.json.jbuilder @@ -3,4 +3,5 @@ json.avatar_url resource.try(:avatar_url) json.channel_id resource.channel_id json.name resource.name json.channel_type resource.channel_type +json.account_id resource.account_id json.provider resource.channel.try(:provider) diff --git a/spec/controllers/api/v1/accounts/contacts_controller_spec.rb b/spec/controllers/api/v1/accounts/contacts_controller_spec.rb index f43517ab5..54c87e86d 100644 --- a/spec/controllers/api/v1/accounts/contacts_controller_spec.rb +++ b/spec/controllers/api/v1/accounts/contacts_controller_spec.rb @@ -80,7 +80,7 @@ RSpec.describe 'Contacts API', type: :request do expect(contact_emails).to include(contact.email) first_inbox = contact_inboxes[0]['inbox'] expect(first_inbox).to be_a(Hash) - expect(first_inbox).to include('id', 'channel_id', 'channel_type', 'name', 'avatar_url', 'provider') + expect(first_inbox).to include('id', 'channel_id', 'channel_type', 'account_id', 'name', 'avatar_url', 'provider') expect(first_inbox).not_to include('imap_login', 'imap_password',