TeamDesk Knowledge Base & Support

   Home      FAQ      Forum      Idea Exchange      Ask a Question      My Stuff      Help   
  
Quickbooks Online Webhooks?
Has anyone set up a QuickBooks Online webhook using TeamDesk's webhook feature? I currently use Zapier, but I'd love to be able to save some zap tasks by using the webhook feature in TeamDesk.

Really just looking to pull basic data when invoices are created (Invoice ID, Total, etc.)

I have an Intuit Developer acct and Sandbox already. Just hoping someone might be able to provide some guidance.

Thanks in advance!
ID
1430
Category
Integration/API
Author

Admin Account
Date Created
3/19/2021 3:28:39 PM
Date Updated
4/16/2021 12:17:53 AM
Comments
basenine 3/20/2021 3:24:53 AM
I’m not going to be much help with you on this, I’m sorry...
I’ve ½ done a Xero integration...but have been waylaid on other pressing projects.

The initial setup was very straight forward and easy. I simply read the blog and followed the steps there.
I’m only seeing a very limited data response set return so I’m not sure what I’m going to do with it yet.

Hopefully next week will present an opportunity to investigate properly.
I’ll keep you posted

Admin Account 3/20/2021 7:08:53 PM
Thanks for your input basenine. I would love to hear from you if you get a chance to work on it. Not sure how Xero works. But I from what I've read in the QBO API documentation, I need to jump through some hoops to make it work.
basenine 3/23/2021 7:14:32 PM
I'm afraid there's not much to report on here.
I checked out the Webhooks function I'd set up earlier and can report I only get the following response:
EVENT TYPE: CREATED (or UPDATED)
from this:
POST https://basenine.dbflex.net/secure/db/xxxxxxx/XeroStatus HTTP/1.1

{
"events": [
{
"resourceUrl": "https://api.xero.com/api.xro/2.0/Invoices/c3xxxxxxa-e1xxxxxxxxxxd4a8af",
"resourceId": "c3xxxxxxa-e1xxxxxxxxxxd4a8af",
"eventDateUtc": "2021-03-24T00:06:34.58",
"eventType": "CREATE",
"eventCategory": "INVOICE",
"tenantId": "04xxxxxxx-2xxxxxxxxxx46f7a",
"tenantType": "ORGANISATION"
}
],
"firstEventSequence": 642,
"lastEventSequence": 642,
"entropy": "YFOTJxxxxxxxxxxTNYVCTLLE"
}
This is all Xero pushes out.

I'd really like to get a STATUS changes from Draft-->Pending-->Sent-->Paid

Over to TD for a way to do that 😀

Kirill Bondar  Staff  3/24/2021 7:10:47 AM
Quickbooks webhook does not receive actual data, rather short description of what happened and where. Then you should call their API back with Call URL action to extract full information of changed entity.


As far as I get from Quickbooks docs here is what you'll get into webhook:

https://developer.intuit.com/app/developer/qbo/docs/develop/webhooks/managing-webhooks-notifications#sample-payload

{
"eventNotifications":[
{
"realmId":"12345678",
"dataChangeEvent":
{
"entities":[
{
"name":"Invoice",
"id":"1",
"operation":"Create",
"lastUpdated":"2015-10-05T14:42:19-0700"
}]
}
}]
}

You'll need to extract:
$.eventNotifications[0].dataChangeEvent.entities[?(@.name=='Invoice')].operation

to, say Operation field

and

$.eventNotifications[0].dataChangeEvent.entities[?(@.name=='Invoice')].id

to, say Invoice ID field

and if operation is Created use Call URL to call

GET https://quickbooks.api.intuit.com/v3/company/<realmId>/invoice/<%[Invoice ID]%>

attached to Record Change/Create trigger

With best regards,
Kirill

basenine 3/25/2021 3:59:40 AM
Thanks for this Kirill,

My premeditated thought of what a web hook would offer was wrong...yep..... I made an assumption 😉

I was thinking that a web hook would notify an endpoint and push out all the data it could on that notification.
Now I get it, though....Instead of me having to write 24 periodic triggers set to run on the hour which ask "Any changes yet?", I simply replace those with a web hook. The web hook notifies the endpoint as soon as there IS a change... and the endpoint says "thanks for letting me know, I'll run my request now".
Kirill Bondar  Staff  3/30/2021 6:35:03 AM
> would notify an endpoint and push out all the data

Depends on the data provider. Some push all the data through the webhook (HelloSign for example), some just send a location leaving data retrieval to the receiver.
basenine 4/14/2021 10:22:30 PM
Hello Kirill,

I'm noticing with the Xero webhooks, all I'm receiving in the payload is a ResourceId and ResourceURL, a TenantId.....and a bit more. None relate to the Invoice ID or Invoice URL, so....how to get a match?

Here's the payload:
"events": [
{
"resourceUrl": "https://api.xero.com/api.xro/2.0/Invoices/abracadabra-a357-4485-94ad-kabam",
"resourceId": "abracadabra-a357-4485-94ad-kabam",
"eventDateUtc": "2021-04-15T01:03:26.581",
"eventType": "UPDATE",
"eventCategory": "INVOICE",
"tenantId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"tenantType": "ORGANISATION"
}
],
"firstEventSequence": 4,
"lastEventSequence": 4,
"entropy": "DHPQGXXXXXXXXXXXXBX"
}

(I'VE ALTERED THE ACTUAL RESPONSE data)

I've cross referenced the Resource Id with existing Invoice Id's and I can confirm they are not the same thing.
I can't see how I'd relate these...
Having said that, I'm waiting for some more payloads to come through, now that I've set up the Webhook responses to go into the correct fields.
My lasting hope is that the Invoice ID GET call also has another Id...and that may be the relatable id.
I'll keep you posted on that one 😀
basenine 4/15/2021 12:57:42 AM
As a side note....I didn't notice the service had been 'stopped'. Not sure if this is automated or if the Periodic triggers had overwhelmed the service or if I'd pressed the stop button by mistake...

Just waited 6 hours and (obviously) nothing was happening 😉

Kirill Bondar  Staff  4/15/2021 5:47:50 AM
@basenine

If you look closely to "ResourceURL" you'll notice it points to invoice:
../Invoices/abracadabra-a357-4485-94ad-kabam

I guess they use uniform structure for all events -- "eventCategory" specifies what object the event is related to, "resourceId" and "resourceUrl" specify the Id of the object and an API URL the object can be retrieved from.

---

"Stopped" means we do receive and store the data in intermediate storage, but do not run record creation process -- new records will be created once you "Start" the webhook.
basenine 4/15/2021 6:24:41 AM
Thanks Kirill. Yes, I did notice that.
From what you’re saying, I should be able to do a callURL to that resource and see what I get. It seems to be a long winded way about it.
Like I mentioned, the resource Id does not relate at all to the Invoice Id
Doing another call to that resource seems kind of dumb....why not just serve the invoice Id?

basenine 4/15/2021 6:32:58 AM
Oh....and I know it’s Xero serving the [dumb] information 😉
Kirill Bondar  Staff  4/15/2021 9:00:38 AM
In fact it's a widespread way to represent an event -- if service handles thousands of subscribers or events happen frequently they have to have compact notification representation. Also, there is a bit of added security.

Would we do Outbound Webhooks in TeamDesk, we would do the same.
basenine 4/15/2021 5:58:24 PM
My initial thought was for added security, too...however:
Let's say all I want is the TV....and you give me the keys to the house.🤣
With respect to Xero's webhook setup, it gives two options/choices of accessible data:
- Contacts
and/or
- Invoices
Me, being me, expected detail relating to either one of those choices, not *neither* of those choices.

I'll set up the GET call now and see what I receive 👍
basenine 4/15/2021 6:32:20 PM
And....success.
Flaming hoops have been cleared 😳
It's almost like the Interrogation scene from "Cop Out", 2010
basenine 4/16/2021 12:17:53 AM
Well....This next passage is for those who want to streamline their setup experience with Xero...
(And sorry to the OP for hijacking the thread)

To be honest, after much going between lots of records yesterday, I found why the [xero] Resource ID did not match the Invoice ID.

In fact, I have found that in most cases they actually DO match.

The trouble was two-fold...
First, I'd selected to receive Contacts AND Invoices in the Xero webhook setup.
By chance, and without realising, some of the records I was trying to compare were Contact Resource Id's...These are very much different from Invoice Id's.
Secondly, and again by chance, I'd selected some records that were not in TD but had been created independently in Xero.
So out of the 5 or 6 records I'd sampled (that's pretty much all I had to go on at that stage), they were either contact updates or invoices that were not in TeamDesk.
An unfortunate sample selection.

It would be nice if there were filtering options at the XERO end, so I could only push UPDATES from certain Invoice #'s (which we've set differently to TD Invoice #'s)...alas...this is not possible.

## This next bit is important ##
I have found instances where I'm getting an Update/Create record and the Invoice Id does not match anything in BOTH Xero or TD...
That one IS strange. This is the case in about 20 of 53 records!
Feedback
Back to Search Results