Integrate Any Custom Software with Zapier: A Beginnerโs Guide to API Documentation | Tutorial โ
Let's build with Zapier and AI (100+ videos)๐
2023-09-08
Transcript โ
[00:00] everyone I hope everyone's having a great day welcome back to Corbin AI where I am showcasing ways to start leveraging artificial intelligence in your personal and your business life now today's video is going to be a piggyback off the video we did here where essentially we showed ways to start integrating uh based off API requests and what I mean by that essentially is essentially when an app within zapier gives the ability for API requests uh we showed ways in order to use chat gbt as a complete beginner in order to achieve that end goal of getting that specific action to incur so the purpose of this
[00:30] video is essentially how do we do that if we don't have the ability to do API requests and this came from some of my viewers here as you see here essentially as in the video if you guys would be interested and we got a response here y'all wanted to see this video so we're gonna go ahead and create that today essentially our goal with this video is for you to get a full comprehensive understanding when it comes to API calls specifically in the context when we have no access to underlying data or API requests within zapier so this is going to be completely based on web hooks completely based off reading API documentation we're going to learn the
[01:01] fundamentals and essentially everything you didn't know when it comes to this context I also want to point out Shameless little promo here follow me on Twitter if you want to be notified when videos are coming out or the topics of videos that are coming out I will go ahead and tweet every single day of the different video and the different topic that we plan on discovering for that day without further Ado let's go ahead and jump in here and let's learn how to do this now when thinking of showcasing this video I was thinking of okay what is the best way to do this so you have a full understanding of what's incurring
[01:31] intuitively because that's a very important fundamental aspect of understanding what it means to basically call upon an app within zapier that isn't natively integrated and the first step of understanding what this all means is the authentication process so what I mean by that essentially is if I come back over here to zaps and if I go over to apps essentially this is zapier's version of an authentication process this essentially is what gives you the ability to access the apps here and do specific actions within the apps because it knows that you have you know
[02:03] essentially authentication of the ability to do it right so you in their back end they see that little signal of whatever that may be that little access token in this context that says hey you can you know make a post of banner Bearer where you can make a post with buffer or you can uh use chat gbt because you have your access token your author authorization so what that means in the context of doing this with basically no native integration of Zap years we have to understand intuitively essentially the API documentation we're dealing with so let me just give an example real quick if I type in
[02:34] Google API access token expiration this tells me essentially how long I have access to an underlying software that may not be natively integrated into zapier so what I mean by that essentially is as you see here for Google cloud and all the software associated with Google YouTube calendar Drive everything Associated they give you a expiration date for your token every one hour so that might seem intense that is a little bit more on the intense side when it comes to API
[03:04] documentation that essentially after an hour when you try to do another function within that app you will it will fail because you you know your your access token your key in order to do the function expires an hour so what do you have to do in that context is you have to get another access token in order to achieve that function so what's great about zapier is they handle a lot of that heavy lifting that's why you know when you integrate YouTube or Google Calendars you don't have to see any of that because there is another layer to this the next layer to this is that okay so you have your access token how do I get
[03:34] a new access token without going through the authentication process again in order to do that you have to get a refresh token that would be given with the access token so with the refresh token when you lose uh X when you lose the access token the refresh token will incur you'll do a call or a post and then that will create us a new access token that we can start leveraging again now everything I just said there might be very confusing don't worry um that kind of stuff you don't have to worry about too much I just need to give you this this context because different softwares have different limitations when it comes to their access token and
[04:06] essentially your ability to leverage um you know accessing the data there that being said if you're dealing with a software that essentially for example Google and their access token expiration date is one hour no matter what and there is no way you can change that and I'm going to show you a different software today's tutorial that allows you to basically set the amount of time for the expiration which is really nice and different documentations allow this that being said in order to do that and essentially uh and have it refresh the token and access token there it's a very complex flow but
[04:39] the idea essentially is this you would set up a flow where you'd create a database and then in that database you would have your refresh token and with your fresh token you would essentially every time you'd set an expiration timer associated with that access token and within the the flow when the expiration date or expiration time in this context an hour reaches zero then we would call upon it automatically to do the refresh token that's a whole other video if you want to see that video let me know that's very complex but menu would learn a ton of stuff when it comes to really understanding intuitively what it means
[05:10] to access API but for now in today's tutorial here we're going to go ahead and showcase all this information with our friend here at printful and the reason we're choosing printful is two main reasons first main reason is because uh I mean I recently did a whole series on this for Drop Shipping so I thought that was pretty cool but the second main reason is that this is a software that essentially is pretty clear and dry cut when it comes to AP integration and just understanding what it means to have an access token plus it doesn't natively integrate with zapier
[05:40] at all and what I mean at all I mean it doesn't even show up as the apps anymore they deprecated the ability to integrate uh within zap years back in so we're gonna have to do basically all web hooks don't worry let's go and start learning this so the way you would essentially approach any of the softwares that you are dealing with is you need to understand the First Fundamental question what is the expiration date on the access token if they allow you to set it then perfect everything from here on out is going to be good sunshines and rainbows if they don't let you just set the expiration time as you'll see in this video and it is very hard stuck
[06:11] like Google where it's basically every one hour no matter what it's going to expire that is when we ventured down a different path and we have to venture down a path that basically sets up even more complex Flows In order to ensure that the access token's still there all right let's go ahead and jump in um to start off using printful uh with any type of software you're just going to type in you know printful API printful API documentation you put in your software name API API documentation and from there we can go ahead and just say start building in this context so I'm going to hit start building sign into printful here and within printful
[06:44] essentially I've already set up these two stores these were part of our Drop Shipping series showing how to build out a fully AI automated Drop Shipping Store I've already set them up so what we can do is we can call upon them so essentially the way you would do this in this context is that uh we would just set this up as a manual order platform or API so I created this there you go and then from there let's go ahead and start understanding intuitively what it means to create a token so for our case we would be creating a token here as you see here private token this allows us to access the underlying API within that store so I create token and everything
[07:17] I'm showing you here will be able to be applied to multiple different platforms this is just printful's way of providing you a token and kind of walking through this but access tokens authorization Bearer tokens all this stuff is synonymous within this industry and the way data communicates with itself between the softwares so that being said let's go ahead and jump in and build out this token so I'm going to go ahead and just call it example token for today's video I'm gonna put it in a contact email here put on the contact email here and here is the big one here so this is
[07:47] the expiration date this is what I was just talking about for the last two to three minutes this is what's gonna allow me to set when this uh token expires when it expires I can no longer make requests on behalf of the software no longer in this context no longer create products no longer creates order status is no longer you know do x y z on the platform this is huge so in this context they say you can Max load it to two years which is amazing so essentially everything you build within the platform you don't have to worry about for two years in theory if I just kept clicking
[08:18] here for today's video though because I'm going to show you the API key just straight up I'm just going to go ahead and choose one day so if you get to this video fast enough then I guess you get access to it uh but we're gonna go from there so essentially next is going to be the access level so this is very standard in API documentation it's going to ask essentially okay so you want to create a token you set your expiration date what are you going to give access to so for this one I will just give access to eyewear and then from here we're going to go ahead and give the Scopes so now that we
[08:48] know exactly where we're getting the specific access to now we're going to tell uh essentially what can you do within that axis like the limitations with access so in most context you're going to basically choose all of this and kind of proceed from there because you essentially want to give this admin level access to everything so I'm going to say create new token once you've created your new token here you're going to be provided with the access key as you see here two main things about this first main thing about this is save this somewhere save it somewhere private save it somewhere secure there are some
[09:20] platforms for example open AI API that essentially when you create an access token uh you'll never be able to see these numbers again you'll never be able to see these characters again you'd have to create a new one so knowing that make sure to copy it save it somewhere safe and then kind of proceed from there the thing is it goes without saying never share your access token because if you give someone your access key essentially they'll be able to do everything that's shown here uh just by doing calls as you'll see in this video so go ahead and shade it save it if I can speak and let's go and proceed this to uh more in-depth tutorial here so once you have
[09:52] created a token for your specific platform you're going to type in the platform's name and then just type in API documentation and it's going to take you to something like this a lot of different platforms have different ways of showing the documentation now this seems overwhelming to you and you're like I don't know what any of this means and you know this seems very complicated I encourage you to check out that video that I showed you at the beginning of this video as I show you how to leverage Chad gbt to really understand everything that's going here and you kind of learn step by step and as we know knowledge compounds and the more you learn about a certain tasks and certain flow a lot of this stuff is going to become a lot
[10:23] easier for you to do that being said essentially with the majority of what you need to understand here is going to be your request endpoint your request endpoint in this context is going to be essentially what most of your web hooks are going to be pushing towards and essentially everything after this request endpoint is going to be the specific function you wanted to do let me explain a little bit more so essentially if I go to post here what you'll notice here is like okay what's going on here why does it just say store products is because we're going with the specific endpoint that I
[10:54] showed and then we're adding store products this tells this API hey I want to do a function for this specific uh parameter within your API and then this you're gonna hit curl here for zapier this is what's going to be essentially the payload the payload is the data you're pushing forward or taking back so and a lot of web hook context essentially post is you're taking data from your soft your back end so this context would be zapier and you're pushing it towards printful's back end in this context git is receiving or
[11:25] taking data from uh printful's back in and sending it to zap use back in so knowing that I'm going to show you both posts and get in this video so you can kind of get a full understanding of what's concurring but from here essentially the way they structure their documentation and most documentations is you'll be able to see you know very general headers and then everything that's associated with the abilities that it has so for example if it orders API I can say get list of orders create a new order get order data stuff of that nature let me go and show you another API so you can kind of just understand
[11:56] like you know this stuff isn't really that scary you know just understanding how to read it and another API you can start looking at is for example is YouTube right so they structure the same way channels lists update and you can learn more about it a lot of times they give you example code a lot of times they give you stuff to understand I mean I just love Google just because you already know they they're going to be very professional in the way they provide everything and really want you to start using their API um that's a whole other conversation to be had because there's a ton of stuff you can do with just Google's clouds API it's a lot of fun stuff but just to give
[12:28] you reference there you go there's another API documentation list there from here though as you see here here's a big one so essentially authentication is the access token that we received earlier as you see here for you to authenticate uh printful's API it's actually really simple all you need to do is basically authorize here do a bear and then provide your underlying token so let me go ahead and show you what that looks like in zapier okay so we're coming over to zapier here I'm gonna go ahead and create a new zapier and you might have been like what are all those apps that's all the tutorials we've done here and and then
[12:59] some there's tons more so if you want to learn more here and you're new to this channel check out all those other tutorials but from here we're gonna go ahead and just say uh API raw because we have no native integration and then essentially what we can do here is I'm just gonna set up a scheduler so we can just start messing around with the data or you're not going to start showing you everything so you know let's just say we want to schedule this and every day we wanted to get the products that are found within our store currently so first off let me go ahead and just do midnights hit continue here and then we just go and test this trigger all right there you go so we just tested that it's
[13:30] just a simple call there so the first thing I need to do actually is let's go ahead and create a product and then we're going to do that's gonna be a post function and then we're going to do another function that's going to be a git function we're going to get the data for the product and then I'm essentially going to show you how to read the documentation so when you do this kind of thing you're not gonna be able to type in printful sadly that's the whole point of this tutorial so we're going to type in web hook so web Hooks and then essentially this really is is this is use case or depends on the use case so your intuitive Your Instinct might be like oh
[14:00] perfect post okay let's go ahead and continue not necessarily sometimes we need to do a custom request and the reason we need to do a custom request so let me go ahead and jump over the documentation here and let me go to products let's say create a new sync product post sending data the reason we need to do it uh a custom request is because we have a huge payload here if I were to do just a regular post action here as you'll notice uh we can't really insert that all that JavaScript all that data that's in there we can't do it because there is no box for this that's
[14:32] why a lot of times uh you may need to do a custom request if you have a big payload and then essentially choose your method here so we're gonna do post and then we're gonna have to choose our URL so you know to find our URL okay we're doing this one so we're gonna go ahead and copy this command C command V okay so we know that we're using the post action to create a new product here and then this you can typically ignore this you can typically ignore this you can definitely ignore it so a lot of I mean from at least my experience a lot of times documentations don't allow basic
[15:03] auth and what basic auth is is basically your username and password so whatever my username and password was for printful that's what it would be in this context but it doesn't work so what we need to do is headers so headers is what we saw earlier in the documentation if I come back over to authentication and as you see here we got authorization bear and then our API key so this is a header here this is where the you know identified header to copy this I'm gonna paste this I'm gonna come over here I'm going to cap the bear and then essentially what is it requesting the API token so I'm gonna
[15:34] grab that put the API token here and now we have full on authentication with the process here all we need to do is go to the authentication part of the documentation listen and just read what essentially wants us to do and we're good to go so now that we have that essentially we can enter in our payload so let's do our payload here so let's go ahead back over to products here and as you see here we have the code Associated what we need to do and in order to troubleshoot and know what we're doing here typically we're not going to put in the you know this is header here right so we put that in the header don't put data raw we're just going to grab it up
[16:04] to here we're going to copy this and we're going to paste it back over here once we do that we can go ahead and close it in there and as you see here essentially we have our name of the product we're creating the thumbnail of the product the price of the product the variant ID now depending on the call and the function you can probably add more variables here and more data here you just have to read into the API documentation and as you see here we have the files for the front and the back of the underlying product we're creating here with the variant ID a lot of the times if you have questions about specific uh identification or variables
[16:36] you can just search in the documentation but from here though let's just go show go ahead and show a successful push with completely Uh custom API calls as you see here the request was sent to zapier and if we jump back over to our product here we have no products here let's go to reload and there we go here is our product so we got our products here obviously I didn't you know change anything I didn't add any different logos or images or stuff of that nature but doing stuff like this essentially allows you to
[17:06] understand okay so that worked and this kind of gives you a ground zero when dealing with API documentation of like let's just put in the example code they gave me so I can just see if it even works before I start going a little crazy so as you see it works perfect now let's go ahead and show you a git function and what's great about some functions is we don't even need to worry about making it a custom request if the payload isn't big enough so essentially if there is no raw data for us to grab so we can do a git here I believe let me go ahead and check this out real quick
[17:37] we're gonna say get sync products here and as you see there is no craziness and all it is just requires is an authorization so to do so we're going to go ahead and do this and essentially we're using the same endpoint but we're just doing it as a git because we're trying to grab data from printfuls back in so I'm going to go ahead and grab these headers again authorization paste that here and action command C command V
[18:08] and then this should bring us all the data Associated unless I needed to add uh more stuff to the underlying URL let's see there we go so we got the data Associated we just created that t-shirt two variants thumbnail everything associated with that underline product we just created now let's go ahead and take this one step further here for you to understand what this even means what does Curry String params mean security string params essentially is some documentation you can add additional information in the payload URL so that's
[18:39] another way essentially of rather than doing a data like a raw data or essentially just put the data straight up in this huge block here sometimes with API documentation you can add a query string param so the best and easy example I can think of is using like YouTube's API documentation so if I just come over here and I go to channels and list uh come over here as you see this is like the the request this is the Euro we've been dealing with but then there's other parts we can add so we can add a part here for you know specific stuff so as you see here if you
[19:09] come down um essentially the way that works is typically you'd write it out as if I come back over here you write it out as part and then whatever the additional information you want to add so so for example if I went to comments here or let's just say comment threads and I wanted to list or get a specific function within comment threads in this context this is like grabbing like a specific comment channel in within YouTube's API I would grab this and then because of the fact as you see here uh
[19:40] we got parts and then we're gonna basically identify what kind of part we're dealing with here whether it's a string ID replies or snippet so for us it's going to be parts and then we'd be snippet so we do part and then snip it and then oh I can put this in here then essentially this is adding this to the URL here and then we're going to go ahead and increase this and essentially what do we want so let's say we want the video ID and we do video ID and then we would put in the relevant video ID and we defined the specific comment thread for that
[20:10] video ID on YouTube okay so that covers most of what you need to understand when it comes to integrating non-native apis within zapier now this might be overwhelming if you've never dealt with web hooks or never dealt with API documentation but don't worry it becomes a lot easier once you intuitively understand what's actually happening essentially everything I'm showing you here happens already within the automations you build it's just that zapier packages it and makes the UI look really nice and a lot more simple a lot more simple so
[20:41] for example to create the product that we did in printful this would have just been a simple little create product if it was a printful integration create product and then it would be like what is the thumbnail you want what is the front of the design what is the like stuff of that nature right so it's all the same it's just you gotta actually look at the code rather than the nice little UI zap you provides but without further Ado make sure to like the video if you got some value out of it we do a ton of stuff when it comes to artificial intelligence so make sure to subscribe as we are providing daily
[21:11] content like this and on a bunch of other topics make sure to like the video uh in the sense that it lets me know if you want more content like this this was probably more on the advanced end of the type of content I typically do on this channel but if I see a lot of encouragement and a lot of love in the comments essentially tell me they want more you know content of this variety then I'll go ahead and produce more of this type of you know breath but without further Ado I'll see you in the next video thanks for tuning in and yes surprise
[21:42] I'm an AI Avatar make sure to explore more here at Corbin AI where we demystify AI for your personal and business life until next time