Speaker 1: Hey 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 gonna be a piggyback off the video we did here, where essentially, we showed ways to start integrating based off API requests. And what I mean by that essentially, is essentially when an app within Zapier gives the ability for API request, we showed ways in order to use ChatGBT as a complete beginner in order to achieve that end goal of getting that specific action to incur. So, the purpose of this 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, I essentially asked 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 gonna be completely based off webhooks, completely based off reading API documentation. We're gonna learn the fundamentals and essentially everything you need to know when it comes to this context. Also wanna point out, a shameless little promo here, follow me on Twitter. If you wanna 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 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, essentially authentication or the ability to do it, right? So in their backend, they see that little signal, whatever that may be, that little access token in this context that says, hey, you can, you know, make a post with BannerBear or you can make a post with Buffer or you can use ChatGPT because you have your access token, your authorization. So what that means in the context of doing this with basically no native integration of Zapier is 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 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 documentation that essentially after an hour, when you try to do another function within that app, you will, it will fail because you know, your access token, your key in order to do the function expires in 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 even 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 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 access, 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, that kind of stuff, you don't have to worry about too much. I just need to give you this context because different softwares have different limitations when it comes to their access token and essentially your ability to leverage, 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, there is no way you can change that. And I'm gonna show you a different software in 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, and have it refresh the token and access token, there is a very complex flow, but the idea essentially is this. You would set up a flow where you'd create a database and then in that database, you'd 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 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 nother video. If you wanna see that video, let me know. That's very complex, but man, you'd learn a ton of stuff when it comes to really understanding intuitively what it means to access API. But for now, in today's tutorial here, we're gonna go ahead and showcase all this information with our friend here at Printful. The reason we're choosing Printful is two main reasons. First main reason is because, I mean, I recently did a whole series on this for dropshipping, 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 at all. And when I mean at all, I mean it doesn't even show up as the apps anymore. They deprecated the ability to integrate within Zapier's backend, so we're gonna have to do basically all webhooks. Don't worry, let's go ahead 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 gonna be good, sunshines and rainbows. If they don't let you to set the expiration time, as you'll see in this video, and it is very hard stuck like Google, where it's basically every one hour, no matter what, it's gonna expire, that is when we venture 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 to start off using Printful with any type of software. You're just gonna type in 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 gonna hit start building, sign into Printful here. And within Printful, essentially I've already set up these two stores. These were part of our dropshipping series, showing how to build out a fully automated dropshipping 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 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 I'm showing you here will be able to be applied to multiple different platforms. This is just Printful's way of providing you with 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 gonna go ahead and just call it example token for today's video. I'm gonna put it in a contact email here, put in the contact email here. And here is the big one here. So this is 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 token expires. When it expires, I can no longer make requests on behalf of this software. No longer, in this context, no longer create products. No longer creates order statuses. No longer do XYZ on the platform. This is huge. So in this context, they say you can max limit 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 here. For today's video though, because I'm gonna show you the API key just straight up, I'm just gonna go ahead and choose one day. So if you get to this video fast enough, then I guess you get access to it. But we can go from there. So essentially next is gonna be the access level. So this is very standard in API documentation. It's gonna ask essentially, okay, so you wanna create a token, you set your expiration date, what are you gonna give access to? So for this one, I'll just give access to eyewear. And then from here, we're gonna go ahead and give the scopes. So now that we know exactly what we're getting the specific access to, now we're gonna tell essentially what can you do within that access, like the limitations with the access. So in most context, you're gonna basically choose all of this and kind of proceed from there because you essentially wanna give this admin level access to everything. So I'm gonna say create new token. Once you've created your new token here, you're gonna 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 platforms, for example, OpenAI API, that essentially when you create an access token, 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. Second 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 just by doing calls, as you'll see in this video. So go ahead and save it, if I can speak, and let's go ahead and proceed this to a more in-depth tutorial here. So once you have created a token for your specific platform, you're gonna type in the platform's name and then just type in API documentation, and it's gonna take you to something like this. A lot of different platforms have different ways of showing the documentation. Now, if this seems overwhelming to you and you're like, I don't know what any of this means and 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 ChatGBT 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 task, a certain flow, a lot of this stuff is gonna become a lot easier for you to do. That being said, essentially, with the majority of what you need to understand here is gonna be your request endpoint. Your request endpoint in this context is gonna be essentially what most of your webhooks are gonna be pushing towards, and essentially, everything after this request endpoint is gonna be the specific function you want it 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? It's because we're going with the specific endpoint that it showed, and then we're adding store products. This tells this API, hey, I wanna do a function for this specific parameter within your API, and then this, we're gonna hit curl here for Zapier, this is what's gonna be essentially the payload. The payload is the data you're pushing forward or taking back. So in a lot of webhook context, essentially, post is you're taking data from your backend, so this context would be Zapier, and you're pushing it towards Printful's backend in this context. Get is receiving or taking data from Printful's backend and sending it to Zapier's backend. So knowing that, I'm gonna show you both post and get in this video, so you can kind of get a full understanding of what's occurring. But from here, essentially, the way they structured their documentation and most documentations is you'll be able to see very general headers and then everything that's associated with the abilities that it has. So for example, if I hit orders API, I can say get list of orders, create a new order, get order data, stuff of that nature. Let me go ahead and show you another API so you can kind of just understand like, 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're gonna be very professional in the way they provide everything and really want you to start using their API. That's a whole nother 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 you a 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 Printful's API, it's actually really simple. All you need to do is basically authorize here, do a bearer, 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've been like, what are all those apps? That's all the tutorials we've done here. And then some, there's tons more. So if you wanna 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 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 I can start showing you everything. So let's just say we wanna schedule this and every day we want it to get the products that are found within our store currently. So first off, let me go ahead and just do midnight, hit continue here, and then let me just go ahead and test this trigger. I said that it's 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 gonna do, that's gonna be a post function. And then we're gonna do another function. That's gonna be a get function. We're gonna get the data for that product. And then I'm essentially gonna 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 gonna have to type in Webhooks. So Webhooks, and then essentially, this is use case or depends on the use case. So your intuitive, your instinct might be like, oh, 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 to the documentation here. And we go to products. Let's say create a new sync product, post sending data. The reason we need to do a custom request is because we have a huge payload here. If I were to do just the regular post action here, as you'll notice, we can't really insert all that JavaScript, all that data that's in there. We can't do it because there is no box for this. That's why a lot of times, 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 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. So a lot of, I mean, from at least my experience, a lot of times documentations don't allow basic 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, bearer, and then our API key. So this is a header here. This is where the identified header. So I'm gonna copy this, I'm gonna paste this, I'm gonna come back over here, I'm gonna cap the bear. And then essentially, what is it requesting? The API token, so I'm gonna 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 it 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 with what we need to do. And in order to troubleshoot and know what we're doing here, typically we're not gonna put in the, this is header here, right? So we put that in the header, don't put data raw. We're just gonna grab it up to here. We're gonna copy this, and we're gonna 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 identification or variables, you can just search in the documentation. But from here though, let's just go ahead and show a successful push with completely custom API calls. As you see here, the request was sent to Zapier. And if we jump back over to our product here, we got no products here. Let's go to reload. And there we go. Here's our product. So we got our products here. Obviously I didn't 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 understand, okay, so that works. 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 get 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 get here, I believe. Let me go ahead and check this out real quick. 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 just gonna go ahead and do this. And essentially we're using the same endpoint, but we're just doing it as a get because we're trying to grab data from Printful's backend. So I'm gonna go ahead and grab these headers again. Authorization, paste that here. And action, and C, command V. And then this should bring us all the data associated unless I needed to add 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 underlying 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 query string params mean? Query string params essentially is some documentation you can add additional information in the payload URL. So that's another way essentially of rather than doing a data, like a raw data, or essentially we 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, come over here, as you see, this is like the request. This is the URL we've been dealing with, but then there's other parts we can add. So we can add a part here for specific stuff. So as you see here, if we come down, essentially the way that works is typically you would write it out as, if I can come back over here, you write it out as parts, and then whatever the additional information you wanna add. So for example, if I went to comments here, or let's just say comment threads, and I wanted to list a specific function within comment threads, in this context, this is like grabbing a specific comment channel within YouTube's API. I would grab this, and then because of the fact, as you see here, 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 gonna be parts, and then we'd be snippet. So we'd be part, and then snippet, and then, oh, I can put this in here. Then essentially, this is adding this to the URL here, and then we're gonna 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'd find the specific comment thread for that video ID on YouTube. 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 webhooks, 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. So for example, to create the product that we did in Printful, this would've just been a simple little create product. If it was a Printful integration, create product, and then it would've been 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 Zapier 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 content like this and on a bunch of other topics. Make sure to like the video 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 telling me they want more content of this variety, then I'll go ahead and produce more of this type of breadth. But without further ado, I'll see you in the next video.
Speaker 2: Thanks for tuning in. And yes, surprise, 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.
Generate a brief summary highlighting the main points of the transcript.
GenerateGenerate a concise and relevant title for the transcript based on the main themes and content discussed.
GenerateIdentify and highlight the key words or phrases most relevant to the content of the transcript.
GenerateAnalyze the emotional tone of the transcript to determine whether the sentiment is positive, negative, or neutral.
GenerateCreate interactive quizzes based on the content of the transcript to test comprehension or engage users.
GenerateWe’re Ready to Help
Call or Book a Meeting Now