feat: expose assignable conversation owners

This commit is contained in:
Sojan Jose
2026-06-26 02:07:41 -07:00
parent 4edf626af2
commit ca9bedfba1
13 changed files with 142 additions and 12 deletions
@@ -251,6 +251,28 @@ RSpec.describe 'Inboxes API', type: :request do
end
end
describe 'GET /api/v1/accounts/{account.id}/inboxes/{inbox.id}/assignable_owners' do
let(:inbox) { create(:inbox, account: account) }
let!(:account_bot) { create(:agent_bot, account: account, name: 'Account bot') }
let!(:global_bot) { create(:agent_bot, account: nil, name: 'Global bot') }
before do
create(:inbox_member, user: agent, inbox: inbox)
end
it 'returns assignable agents and accessible agent bots' do
get "/api/v1/accounts/#{account.id}/inboxes/#{inbox.id}/assignable_owners",
headers: admin.create_new_auth_token,
as: :json
expect(response).to have_http_status(:success)
response_data = response.parsed_body['payload']
expect(response_data.pluck('assignee_type')).to include('User', 'AgentBot')
expect(response_data.pluck('name')).to include(agent.name, admin.name, account_bot.name, global_bot.name)
end
end
describe 'GET /api/v1/accounts/{account.id}/inboxes/{inbox.id}/campaigns' do
let(:inbox) { create(:inbox, account: account) }