intercom / intercom-node

Node.js bindings for the Intercom API
https://developers.intercom.com
Other
362 stars 116 forks source link

Wrong request URL when conversation is assigned with "withRunningAssignmentRules" parameter #404

Open feelbadinc opened 2 months ago

feelbadinc commented 2 months ago

Why?

The withRunningAssignmentRules parameter is supposed to append /run_assignment_rules to the URL but instead it appends /run_assignment_rules/parts. The API is throwing the 404 error when you attempt to send a request to this URL.

Intercom API doc article for the reference: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/Conversations/autoAssignConversation/

How?

In original code, the /parts string is being appended to the URL no matter the value of withRunningAssignmentRules variable. I moved the /parts string into the ternary expression so now it's appended only when withRunningAssignmentRules is false or undefined.