Discussions

Expand all | Collapse all

Webhook to create Quickbooks Online invoice?

  • 1.  Webhook to create Quickbooks Online invoice?

    Posted 03-12-2018 19:21
    I'm having trouble using a webhook to create a quickbooks online invoice when a new record is added in quickbase. The trouble is authentication...I have a Quickbooks online developer key for our account, I'm just not quite sure where to plug it in. From what I gather, I need a GET first with that key, then I can POST. Can anyone advise if what I'm attempting is possible (without a 3rd party service)?



  • 2.  RE: Webhook to create Quickbooks Online invoice?

    Posted 03-16-2018 19:15
    Hi Stephanie,

    I did a little bit of research on the Quick Books Online API and they have a pretty standard oAuth flow for obtaining access to their API (see attached image). Unfortunately I don't think this is achievable (at least in a very secure way) via a single webhook.

    Please use this as a reference on the below: https://developer.intuit.com/docs/00_quickbooks_online/2_build/00_build

    As you see in the image in order to make the actual API call to create an Invoice; you need to do the following:



    1) Send a request (GET) using your client key/redirect URI of the app you set up in Quick Books developer

    Request:
    GET https://appcenter.intuit.com/connect/oauth2?
    client_id=Q3ylJatCvnkYqVKLmkH1zWlNzNWB5CkYB36b5mws7HkKUEv9aI& response_type=code& scope=com.intuit.quickbooks.accounting& redirect_uri=https://www.mydemoapp.com/oauth-redirect& 
     state=security_token%3D138r5719ru3e1%26url%3Dhttps://www.mydemoapp.com/oauth-redirect&;

    Response: https://www.mydemoapp.com/oauth-redirect?state=security_token%3D138r5719ru3e1%26url
    %3Dhttps://www.mydemoapp.com/oauth-redirect&code=4/P7q7W91a-oMsCeLvIaQm6bTrgtp7&realmId=1231434...

    2) Take the Authorization Code from the response and make a request for an access token:

    Request:

    POST https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer HTTP/1.1  Accept: application/json  Authorization: Basic UTM0dVBvRDIwanp2OUdxNXE1dmlMemppcTlwM1d2      NzRUdDNReGkwZVNTTDhFRWwxb0g6VEh0WEJlR3dheEtZSlVNaFhzeGxma1l      XaFg3ZlFlRzFtN2szTFRwbw==  Content-Type: application/x-www-form-urlencoded  Host: oauth.platform.intuit.com  Body: grant_type=authorization_code&  code=L3114709614564VSU8JSEiPkXx1xhV8D9mv4xbv6sZJycibMUI& 
    redirect_uri=https://www.mydemoapp.com/oauth-redirect

    Response:

    {   "token_type": "bearer",   "expires_in": 3600,   "refresh_token":"L311478109728uVoOkDSUCl4s8FDRvjHR6kUKz0RHe3WtZQuBq",  "x_refresh_token_expires_in":15552000,  "access_token":"eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..KM1_Fezsm6BUSaqqfTedaA.  dBUCZWiVmjH8CdpXeh_pmaM3kJlJkLEqJlfmavwGQDThcf94fbj9nBZkjEPLvBcQznJnEmltCIvsTGX0ue_w45h7_  yn1zBoOb-1QIYVE0E5TI9z4tMUgQNeUkD1w-X8ECVraeOEecKaqSW32Oae0yfKhDFbwQZnptbPzIDaqiduiM_q  EFcbAzT-7-znVd09lE3BTpdMF9MYqWdI5wPqbP8okMI0l8aa-UVFDH9wtli80zhHb7GgI1eudqRQc0sS9zWWb  I-eRcIhjcIndNUowSFCrVcYG6_kIj3uRUmIV-KjJUeXdSV9kcTAWL9UGYoMnTPQemStBd2thevPUuvKrPdz3ED  ft-RVRLQYUJSJ1oA2Q213Uv4kFQJgNinYuG9co_qAE6A2YzVn6A8jCap6qGR6vWHFoLjM2TutVd6eOeYoL2bb7jl  QALEpYGj4E1h3y2xZITWvnmI0CEL_dYQX6B3QTO36TDaVl9WnTaCCgAcP6bt70rFlPYbCjOxLoI6qFm5pUwGLLp  67JZ36grc58k7NIyKJ8dLJUL_Q9r1WoUvw.ZS298t_u7dSlkfajxLfO9Q" 
    }

    3) You can then use that access token to make API Calls (like your invoice webhook here). You'll notice that it expires in 3600 seconds (1 hour) and you can use the refresh token to generate a new access token for future API Calls -- this is a pretty standard security measure.

    So in summary this cannot be achieved via a single webhook without performing a few authentication steps with Quickbooks

    Since you need to be able to make a few requests prior to your create invoice, I would suggest the following as options:

    1) Use Workato/Zapier's http connectors; you could achieve this easily. Basically your webhook would call your integration recipe, perfrom steps 1-2, and then create your invoice.

    I'd imagine those products have ways to authenticate to Qbooks without these steps (using their connectors), just by plugging in your credentials, so maybe even no need for writing http posts!


    2) Use a tool like Postman to generate your tokens and plug into your quick base webhook.

    Not ideal because you'd have to generate a new one every hour and put in your webhook; although they can be updated with the API so you could create a flow in Postman that can do all these steps with a button click.

    https://help.quickbase.com/api-guide/index.html#api_webhooks_edit.html

    I hope that was helpful, let me know if you have any questions-- I know that was a lot, but I love learning new APIs :)


  • 3.  RE: Webhook to create Quickbooks Online invoice?

    Posted 03-16-2018 19:28
    Thanks so much Charlie! I appreciate the time & advice. I would rather set it up without 3rd party tools if I can help it, but I did end up giving up eventually and using workato :)


  • 4.  RE: Webhook to create Quickbooks Online invoice?

    Posted 08-06-2018 21:47
    Has anyone used Zapier for this? I have a client that I really don't want to add more cost to. Is it possible to do this on the free version to show him that QB will work for him in connecting to his QBks?

    If anyone has done this, can you give me a step-by-step how to of how you made it work? Currently not having much success. I feel like I am just missing some tiny thing, but I could also be way off base.




  • 5.  RE: Webhook to create Quickbooks Online invoice?

    Posted 08-07-2018 14:24
    Yes, I have used Zapier both using their built-in connector and a custom code/webhook solution. Using their built-in connector is far easier because they handle all of the oAuth management. Have you tried that?


  • 6.  RE: Webhook to create Quickbooks Online invoice?

    Posted 08-23-2018 23:30
    Do you have a link to that Zap? 


  • 7.  RE: Webhook to create Quickbooks Online invoice?

    Posted 08-24-2018 13:25
    To the Zap specifically, no, as those are built in a specific account. The QuickBooks Online connector can be read about here: https://zapier.com/apps/quickbooks/integrations">https://zapier.com/apps/quickbooks/integrations">https://zapier.com/apps/quickbooks/integrations


  • 8.  RE: Webhook to create Quickbooks Online invoice?

    Posted 08-07-2018 13:36
    Hi Meredith,

    I ended up using Workato...it's not a free service unfortunately, but works like a charm for keeping Quickbase synced with Quickbooks Online Invoices. I can even update them later if needed by returning the Quickbooks Invoice ID to the Quickbase record.

    Hope this helps!


  • 9.  RE: Webhook to create Quickbooks Online invoice?

    Posted 08-23-2018 23:31
    I know. I love Workato, but I don't think that the small client needing this has the funds for it. :( 


  • 10.  RE: Webhook to create Quickbooks Online invoice?

    Posted 08-24-2018 13:26
    You might want to consider evaluating Zapier vs Workato as they have different pricing models. Zapier is usually more affordable at the smaller scales.


  • 11.  RE: Webhook to create Quickbooks Online invoice?

    Posted 08-27-2018 16:33
    Yes, that is what I have done. It is indeed much less / free fro what I need to do. However, I was asking if any one had used Zapier, and if they had a step-by-step on what worked for them.