intercom / intercom-node

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

Unable to update by companyId with `client.companies.update` #356

Closed mattvpham closed 8 months ago

mattvpham commented 1 year ago

Version info

Expected behavior

In the client.companies.create call, I provide a companyId field that is the company id that I have defined for the company, so I expect the companyId field in client.companies.update to correspond with that same company id.

Actual behavior

It fails to update and throws a 404 Company Not Found error.

Steps to reproduce

  1. Create a company with an arbitrary company id

      await client.companies.create({
        companyId: 'abcdefg', // all good
        name: 'TestCompany',
        createdAt: Math.floor((new Date()).getTime() / 1000),
        monthlySpend: 0,
        industry: '',
        plan: '',
        size: 0,
        website: '',
        customAttributes: {}
      })
  2. Attempt to update that company using the same company id

      await client.companies.update({
        companyId: 'abcdefg', // <-- it's actually expecting intercomId here
        name: 'TestCompany',
        createdAt: Math.floor((new Date()).getTime() / 1000),
        monthlySpend: 0,
        industry: '',
        plan: '',
        size: 0,
        website: '',
        customAttributes: {}
      })

Logs