ServiceTitan API Tutorial: How to Automate Anything With Zapier

Learn to connect ServiceTitan to Zapier by creating a developer app, generating credentials, and building a Zap that queries jobs and posts customer notes. The tutorial covers OAuth setup, the Jobs endpoint, and the Customers API, with warnings that ServiceTitan's API is complex.
What's up, hackers? Today, I'm going to help you unlock the full potential of Service Titan's API. But before we get started, I need to warn you of two things. Number one, once you go down this rabbit hole, your ability to automate so many things may consume all your time. So please don't blame me if you spend nights, weekends and holidays on zapier tweaking out. Number two, Service Titan's API is just like the rest of Service Titan. It's overly complicated, so you may find yourself frustrated with it. But don't worry, I can help you. All right, let's get started. The first thing you'll need to do is go to developer ServiceTitan IO and you'll need to have the ability to create apps. If you are a Servicetitan user, you can just email integrationservicetitan.com request access or go ahead and click this. And here you go, here's the link. So we'll go to Login and create apps. Since you're a Service Titan customer, you're going to go to login as production environment user and we're going to create a new app. The application name is. We're going to title it zapier Connection. Going to put your company name here. Go ahead and put your homepage, your tenant ID here is something that you will get from your actual Service Titan account. You can find that under Settings Integrations, API Application Access. And your tenant ID is here in the top right. Okay, so once we have this, we'll scroll down and we're going to select the API scopes. And these are endpoints. This means what you allow Appier to read and write as far as Service Titan goes. So for me, since I'm building the app in my own account, I'm going to give it access for everything. So I'm just going to click all, all on here. So you can see this is all the information we're going to be able to get. Lots of stuff and they do add more every couple of months. More endpoints now on client credentials management, just keep I, the app developer will configure credentials on behalf of each client. Keep that checked and click Save. You're going to go back to Settings, click Connect New app and you'll notice at the very bottom you have this zapier connection. Click Connect and it's going to ask you for a few different restrictions. Everyone's list may look a little different. I just put no restriction on all of these. And then click Allow Access. Okay. And it's been connected and then you have your tenant value here. The next step, go back to my apps, click View Connections. And now you'll see that that your company's tenant ID is located here and you have a client ID and a client secret that now you have to generate. So you generate the client secret and this is only visible once. So you're going to want to, you're going to want, when you click Continue, you're going to want to copy this and put it somewhere safe. I'm just going to put it in a note off screen and, and we're good. So we're active and now we have all of the credentials that we need to log in. Now our final step after we do View connections is we have to get our Service Titan app key and that is back in the application after it's been created. It's right here. So go ahead and copy that and save that information. Okay, great. Now we can go to Zapier and create our connection. Now we can, now we're back at Zapier where we can actually create our connection. So first, so I'm going to assume that you have some experience with Zapier as far as triggers and actions go. For this specific zap. What I'm doing is I'm taking a file that's been uploaded into a folder in Google Drive and I'm going to put it into the notes section into ServiceTitan Customer. So there's a few things we have to do. The file itself has. The file itself has the job number in the title. So I'm just using a built in format tool from to get the job number. We get the job number and here's where we actually create the Service Titan connection. So here's where we create the Service Titan connection. We're going to use webhooks by Zapier. Our event, we have different options. We're going to use Post, click continue and we're going to put this URL. That URL is going to be the same no matter what Company payload type, form data, Grant type, Client ID and Client Secret. The grant type is always Client credentials and you're going to put your client ID here and your Client Secret there. Remember, Client ID and Client Secret were what we got from our app originally. We're going to leave these the same. We don't need any headers. And when we click Continue and we test it, we're going to get what's called an access token. And that's what allows us to get and post data to the API. So we have our access token. Now what I'm going to do is I'm going to get the job ID from the job number. So I'm going to use webhooks by Zapier Premium custom request. The method is get and then here is the URL. So this URL can become a little tricky, but we get this from this API list which is found developer ServiceTitan IO APIs. These are all the endpoints that we can use. So for this one I am using in the jobs, job planning and management section, get tenant jobs. And here is the full URL we can use. But all we're using here have the job I, the job number and I have my tenant id. So I'm going in and I'm just going to copy this part. And it would look like this, right? Take our tenant id, put it there, jobs question mark. And we'd say number equals. And then we're going to put in the job number which was from the previous step. And all we need here is. So we need our service site and app key in this header. We need to put the actual key here and then this needs to be put in exactly, authorization. And then, and then we go to where we got the token and we put in, we click token, type, error, space, bar, access token. From there, when we click continue, we will get all of this information. These are all the fields that I got from that specific job. Now I got the job id, job number, project id, customer id. Now I'm actually going to send this file in the form of a note into the customer. So I need the customer ID for this. And this is another custom request which is a post request. And you'll know if it's post, get or patch based upon this here where you see right here, I'm going to go back to the API reference, going to go to customers under cr. I'm going to post customer note here. And what I need is I need my tenant id, which I have, and I need my customer ID in this URL, which I have. So here's my tenant ID and my customer id. And then this is a JSON format for the data. This is where it gets a little tricky. You might have to play around with it a bit. But what this is doing is it's putting a note into the job and a link to embed the file and adding it to the top and adding it to all locations. And when I submit that, it's going to tell me this is what happened and when it was submitted. And now the site survey that the file will go to this customer and you'll be good to go.
More from Bill

Capturing the 80%: How SmartAC’s Gen-2 Targets Non-Membership Homeowners | Podcast Ep. 296

Build better customer data with every booking in ServiceTitan | TAD Tune-Up Series

The Biggest Change for Roofers Coming From Other Roofing Software to #ServiceTitan?







