intercom / intercom-node

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

Unexpected behaviour using access token #377

Closed koralesky closed 12 months ago

koralesky commented 12 months ago

Version info

Expected behavior

Using Access Token for [TEST] workspace should add companies to [TEST] workspace using intercom.companies.create(newCompanyData)

Actual behavior

Using Access Token for [TEST] workspace is adding company to it's parent which is production version.

Steps to reproduce

  1. Create workspace
  2. Get authentication token for this workspace
  3. Create [TEST] workspace for previously created workspace
  4. Get authentication token for [TEST] workspace
  5. Initialize new Client({ tokenAuth: { testWorkspaceToken } })
  6. Use intercom.companies.create(newCompanyData) to create new company.
  7. Company is being created in parent workspace instead of [TEST] workspace.

Observations

When using intercom.companies.update with companyId of company that is created in [TEST] workspace, then right company is being edited. However using create method creates company in wrong - parent workspace

I was thinking about using apiKeyAuth, in constructor instead of tokenAuth, cuz that would give me possibility of specifing which appId I want to use, however this solution gives me Authentication Errors, so I suppose that I have to stick with tokenAuth constructor. Unfortunetaly that way I can't manage in which workspace should be created companies.

koralesky commented 12 months ago

Nvm figured it out. Sorry for confusing You

redhotwaffle commented 12 months ago

What caused it? I also experience something similar