From 9c22d791c4d9ea3edeb321e46b393d20b444c349 Mon Sep 17 00:00:00 2001 From: msaleh-313 <168048496+msaleh-313@users.noreply.github.com> Date: Wed, 18 Mar 2026 01:40:45 +0500 Subject: [PATCH] fix: return correct outgoing_url in Platform agent bot API responses (#13827) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Platform API was returning the bot's `name` value for the `outgoing_url` field across all agent bot endpoints (index, show, create, update). A typo in the `_agent_bot.json.jbuilder` partial used `resource.name` instead of `resource.outgoing_url`. Closes #13787 ## What changed - `app/views/platform/api/v1/models/_agent_bot.json.jbuilder`: corrected `resource.name` → `resource.outgoing_url` on the `outgoing_url` field. ## How to reproduce 1. Create an agent bot via `POST /platform/api/v1/agent_bots` with a distinct `outgoing_url`. 2. Call `GET /platform/api/v1/agent_bots/:id`. 3. Before this fix the `outgoing_url` in the response equals the bot's `name`; after the fix it equals the value set at creation. ## Tests Added `outgoing_url` assertions to the existing GET index and GET show request specs so the regression is covered. --- app/views/platform/api/v1/models/_agent_bot.json.jbuilder | 2 +- spec/controllers/platform/api/v1/agent_bots_controller_spec.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/platform/api/v1/models/_agent_bot.json.jbuilder b/app/views/platform/api/v1/models/_agent_bot.json.jbuilder index 8e04e98d7..35e16c0d1 100644 --- a/app/views/platform/api/v1/models/_agent_bot.json.jbuilder +++ b/app/views/platform/api/v1/models/_agent_bot.json.jbuilder @@ -1,6 +1,6 @@ json.id resource.id json.name resource.name json.description resource.description -json.outgoing_url resource.name +json.outgoing_url resource.outgoing_url json.account_id resource.account_id json.access_token resource.access_token.token diff --git a/spec/controllers/platform/api/v1/agent_bots_controller_spec.rb b/spec/controllers/platform/api/v1/agent_bots_controller_spec.rb index ae3ef61e5..d8a2479eb 100644 --- a/spec/controllers/platform/api/v1/agent_bots_controller_spec.rb +++ b/spec/controllers/platform/api/v1/agent_bots_controller_spec.rb @@ -37,6 +37,7 @@ RSpec.describe 'Platform Agent Bot API', type: :request do expect(response).to have_http_status(:success) data = response.parsed_body expect(data.length).to eq(1) + expect(data.first['outgoing_url']).to eq(agent_bot.outgoing_url) end end end @@ -73,6 +74,7 @@ RSpec.describe 'Platform Agent Bot API', type: :request do expect(response).to have_http_status(:success) data = response.parsed_body expect(data['name']).to eq(agent_bot.name) + expect(data['outgoing_url']).to eq(agent_bot.outgoing_url) end end end