From a4a29725a093716f6b7d476c3583a8c5d36c3186 Mon Sep 17 00:00:00 2001 From: Egor <132283466+feelbadinc@users.noreply.github.com> Date: Mon, 22 Apr 2024 17:38:43 +0300 Subject: [PATCH 1/2] Fix URL concat bug in conversation.ts The "withRunningAssignmentRules" parameter is supposed to add "/run_assignment_rules" to the URL but instead it adds "/run_assignment_rules/parts". The API is throwing the 404 error when you attempt to send a request to this URL. --- lib/conversation.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/conversation.ts b/lib/conversation.ts index 060e96e9..0b7d249c 100644 --- a/lib/conversation.ts +++ b/lib/conversation.ts @@ -142,8 +142,7 @@ export default class Conversation { withRunningAssignmentRules = false, }: AssignConversationData) { const url = `/${this.baseUrl}/${id}${ - withRunningAssignmentRules ? '/run_assignment_rules' : '' - }/parts`; + withRunningAssignmentRules ? '/run_assignment_rules' : '/parts'}`; const data: AssignConversationRequest | undefined = withRunningAssignmentRules ? undefined From 87a2adffd68c8019e85ebc335ec1cd5b8a7b5332 Mon Sep 17 00:00:00 2001 From: Egor <132283466+feelbadinc@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:20:32 +0300 Subject: [PATCH 2/2] Update incorrect unit test URL in conversation.test.ts --- test/unit/conversation.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/conversation.test.ts b/test/unit/conversation.test.ts index 3a3c628d..5feab871 100644 --- a/test/unit/conversation.test.ts +++ b/test/unit/conversation.test.ts @@ -321,7 +321,7 @@ describe('conversations', () => { const expectedReply = {}; nock('https://api.intercom.io') - .post(`/conversations/${id}/run_assignment_rules/parts`) + .post(`/conversations/${id}/run_assignment_rules`) .reply(200, expectedReply); const client = new Client({