How to update account-id of existing user.

SOLVE
SRoy
Participant | Gold Partner

Hello,

 

I have developed a Hubspot App that utilizes Hubspot CRM Accounting Extensions API.

The app works fine as it can create invoices or attach invoices to deals or to companies.

Due to some internal feature upgrade, I want to change the "accountId" of the Hubspot user without asking the user to reinstall the app. This accountId was set via "PUT crm/v3/extensions/accounting/user-accounts". But when I unset the accoutId using "DELETE /crm/v3/extensions/accounting/user-accounts/{accountId}", nothing happens. From the accounting webhook calls, I can see that Hubspot still looks for the old accountId when I visit deal details page. 

Interesting fact is that if call "PUT crm/v3/extensions/accounting/user-accounts" with different accountId, that new accountId is get attached. And when I did try "create invoice"button from deal details page, Hubspot shows me two accounts  (the old and new one) to choose from.

 

Is it really possible to remove an existing accountId for a Hubspot user via CRM Accoutning Extension API without the need to uninstall the Hubspot app that atttached that accountId?

 

Regards,

Sujoy

 

0 Upvotes
1 Accepted solution

Accepted Solutions
dennisedson
Solution
Community Manager

@SRoy 

This is the feeback I received (verbatim)

So if I'm reading correctly:
  • The customers deletes a userAccount, and then creates a new one,
  • They're still seeing calls on the deal page that fetches the userAccount that was deleted
The only thing in the deal page that should still contain the old one they deleted would be any previous invoices that were created for that accountId. That is by design, we don't delete invoices for an account if it's disconnected.As for their second point about the accountId showing up if they update it with the update API that shouldn't happen so I'd need to know more information to debug what they mean there.
Thanks,

Dennis




Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content

View solution in original post

0 Upvotes
5 Replies 5
dennisedson
Community Manager

Hey @SRoy 

I am looking into this

Could you provide exact requests and the body that you are sending (minus the hapikey) and maybe some screenshots of what you are seeing?

 

Thanks,

Dennis




Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content
0 Upvotes
SRoy
Participant | Gold Partner

Hello Dennis,

I am using hubspot-api-python library. I am not using hapikey but  Oauth access token. The code is like below,

import hubspot
from pprint import pprint


client = hubspot.Client.create(access_token="<Outh Access Token>");

try:
    api_response = client.crm.extensions.accounting.user_accounts_api.archive(account_id="1124019")
    pprint(api_response)
except Exception as e:
    print("Exception when calling user_accounts_api->archive: %s\n" % e)

When I run it from command line, I just get "None" on the console and no exception is raised.

 

I can perform the same operation using "curl" tool like below,

curl --request DELETE --url https://api.hubapi.com/crm/v3/extensions/accounting/user-accounts/1124019 --header 'authorization: Bearer <Oauth Bearer Token>'

 

I have also tested using the online tool that is provided on https://developers.hubspot.com/docs/api/crm/extensions/accounting page to test API call.

SRoy_0-1627538213954.png

 

 

Since, there is no API endpoint (or I am not able to find it) to check which accountIds are attached to a Hubspot user, it is very difficult to know if the addition or deletion of accountIds works unless to check the invoice creation  process.

 

Regards,

Sujoy

0 Upvotes
SRoy
Participant | Gold Partner

Hello, @dennisedson, any update on the issue?

0 Upvotes
dennisedson
Solution
Community Manager

@SRoy 

This is the feeback I received (verbatim)

So if I'm reading correctly:
  • The customers deletes a userAccount, and then creates a new one,
  • They're still seeing calls on the deal page that fetches the userAccount that was deleted
The only thing in the deal page that should still contain the old one they deleted would be any previous invoices that were created for that accountId. That is by design, we don't delete invoices for an account if it's disconnected.As for their second point about the accountId showing up if they update it with the update API that shouldn't happen so I'd need to know more information to debug what they mean there.
Thanks,

Dennis




Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content

View solution in original post

0 Upvotes
SRoy
Participant | Gold Partner

Thank you@dennisedson for the information.

I opened up create invoice page on a fresh deal and saw that the deleted accountId is not showing up.

So, I think account deletion is working. I will do further testing and then mark your reply as "Accept as Solution".