JSON Payload Breakdown: Getting Data From Your Webhook in ODOO

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
looks like you're excited about web hooks this is going to be the last one where we have a web hook coming into a do so we're going to talk about unpacking the payload which is all the data that's tied to our web hook being able to unpack this data is huge because then we can break down these pieces and put them where we want them to be or perform other actions based on that data now we're not going to cover any ground that we've already covered before we're just going to go ahead and unpack that data so if you haven't watched any of the other videos yet you may want to go back and catch up first anyway hopefully you're ready for this cuz we're going to Dive Right In so I've built this web hook automation Target record I've just said it's something simple because we're not using the target record at this point the big thing here is our execute code so let me go into this so the most important piece of code here is this data equals request.get Json data so what this piece of code does is it allows us to change the Json payload into a dictionary which is basically like a record which we can then pull fields from now you may not always be able to choose the headers of the data that comes to you so I wanted to set this up so you could see basically I'm saying the name that I want to set on my record is data and then this field with this header okay same thing for ex Studio other thoughts data and this header the reason I did this is if we go into the logs and then we look at one of these info items here we can see the payload they got sent to us it's everything right between these squiggly brackets so you see how testing is so so nice well I happen to know that's the title for what I sent so I know that the items right here or the string between here is the header same thing for my extra information I've got the header right here and then the value right here so sometimes you may not be able to set the header yourself so it's good to know that you you can look at the info and the logs and see what your Json payload looks like to take this one step further the reason that I knew my headers were incorrect because I thought I had them correct is that I got this little error right here when I went into the logs so it says attribute error dict object has no attribute ID so in my code I was calling data ID and I wasn't getting anything so you want to make sure that your headers are correct because that obviously could cause some problems so let's go through our example once again real quick so a it's my name kind of messed up my form a little bit then title we're going to say Json breakdown and we're going to say we're breaking down our Json payload then we're going to go ahead and submit this and you see this came through through really nicely but I want to break down the steps of what happened here we've done this in other videos but it hasn't been this complete yet so I want to break it down for you real fast so a response is logged in this Google form here that triggers this trigger right here in zapier that trigger then kicks off an action which is a post web hook that takes all the information that is submitted here we don't change the headers or anything like that it's then pushed over to Odo that hits this URL right here okay and then in our code so once something hits that URL it kicks off this code it breaks down that Json payload into a dictionary which is a lot like a record we then pull specific data or specific attributes out of this dictionary and put them into a new record on our web hook testing app there are a lot of steps here here and a lot of places where this could go wrong which is why it's so important for us to keep these log calls turned on especially in the early days so we can go in here and if there is an error we can break down the error and certainly so that we can look at the info that's being passed with the web hook and break it down if we need to now that was a pretty short video but really all I wanted to show you here is the code that you use to break down your Json payload again if you need more detail on how to set up the web hooks I've got my other video here that you can check out but now we're pretty much finished with web hooks coming into Odo next we're going to talk about pushing web hooks Auto oo and what we can do with that so stay tuned
Info
Channel: ODOOITYOURSELF
Views: 115
Rating: undefined out of 5
Keywords: odoo, odoo tutorial, webhooks in odoo, zapier and odoo, odoo automation, odoo erp, erp software, zapier erp, odoo webhook automation, odoo connection, odoo integration, odoo integration with zapier
Id: RFojz__mO7M
Channel Id: undefined
Length: 4min 41sec (281 seconds)
Published: Tue Feb 27 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.