Video

Creating a customer in Hudu from Autotask, using n8n

A full walkthrough of automatically creating a company in Hudu whenever a new company is created in Autotask, using a webhook and n8n to pass the data across.

Show transcript

Hi everyone. In this video, I'm going to talk about creating a company in Hudu directly from Autotask. When the company is created in Autoask, I'm going to go through the entire process to show you what happens when the company comes out of Autoask. How do we get it out of Auto Task? How do we get it into uh into Hudu?

We're going to be using a tool called N8N. uh we're going to use a web hook out of auto task to bring the information into N8N and then pass that information on to Hudu. So I'm going to go through that entire process with you. What you're going to need in order to do this, obviously you're going to need Autotask. Also going to need Nadn. The free version of Nadn should be fine.

It should work perfectly fine for what we need in this. Um so you can self-host it. um or you can you can host it from their website, whatever the case might be. Um the other thing you are going to need obviously is is Hudu. Once you have those three, pretty much that is all you're going to need in order to get this working. So let's go and take a look at how we uh how we get this to work.

So the very first thing we want to do inside Autotask, there's a couple of things we want to do. Firstly, we want to create a web hook. So we want to say that when a company for example is created um it needs to send a web hook to some other tool. In this case that tool is going to be N. Um so we need to generate a web hook.

We also need to have a custom field on our customer that says, you know, only send this in to Hudu if we select the option of being yes because we don't want every single customer necessarily to be created in um inside Hudu. So, how do we do those? Well, the very first thing we need to do um let's start by creating the company or or the the user defined field within the company. So, first things first, you can either go here to user defined fields. And what I prefer to do though is to come into here under features and settings, accounts and contacts, account categories.

And here we have our category of accounts or standard even. So, what we can do in here is this is where we have this userdefined field in here called add to Hudu. And you can see I've put it right at the very top of all of our other fields. Which means when I click on the plus button and I go into creating a new account, you will see that right at the very top I have add to Hudu and I have my yes no. So how do we create this?

Well, directly from here if you click on add custom field and then you say Hudu for example and then this wants to be a multi select field. sorry, a single select field and you're simply going to put a yes and no in here. So, you're going to go yes, yes, and then no, no, etc., etc. So, you're going to put whatever fields you want in there and simply hit save and close. Right? I'm not going to actually do that.

And then what you will have is right down at the bottom, it will create your your user find field. Actually, let me do it for you quickly. So, if we call this voodoo 2, come down here, and we say single select. And I'm just going to make it yes for now. Okay.

Save and close. What you'll see is right down the very bottom, we now have our Hudu 2. So, you can simply drag this to where you want it to be. If I drop mine in there, um, when I hit save and close, if I was to refresh this now, you'll now see I have my Hudu 2 and that is sitting in here um, as my custom field. So, it's it's really that simple to create a custom field.

I happen to have made mine in here uh, a required field. And the way you would do that is again, if we go back into our account category, we click on details. You can see here I've got the required flag turned on. I'm just going to take this one away. And to turn on the required flag, you simply click in this column somewhere.

So if you see, if I click on the column, I can then check this box on and off. Obviously, I want this to be required because I want somebody to be able to actually fill in this information when uh when they create the uh the company because I want to determine whether the company automatically gets created in Voodoo or not. You can of course leave this off and just say every company gets created. It's entirely up to you. Um, but this is how I'm going to do it for the purposes of this video.

Right. So, a couple of other things we then have to do. We have to be able to tell auto task to get the information out of Autoask and get the information into Hudu. And the only way we're going to be able to do that is via something called an API. uh well an an API but via a web hook through the API. Now the problem with with um auto task is there is no simple way to click a button and say create a web hook.

You have to actually do it programmatically. You have to do it through the API. Um and just to show you how this would work is if we go into extensions and tools web hooks you can see there's currently no web hooks here that are being used in in order task. So I wrote a little tool that allows us to actually do this. So this is a tool that uses the API to create any web hooks that we want for any of the entities that you see above.

So companies, tickets, and contacts. Um, and I'm going to show you how this works. I will make this tool available. It is written in Python, so you can run it however you like. Um, but you do need to install it somewhere.

I happen to have mine installed on a um on a server. So what I'm going to do in here, very first thing I actually need when I create the web hook is I need to tell auto task where to send that information to. So it needs a URL um off the back end of uh you know of this web hook. So how do we do that? So this is where NAN is going to come into play.

So if I click on here and I say create new workflow, the very first thing we want to do is we want to create a new workflow step and we want to say on web hook call and we want to change this to be a post. So now you can see that in here we have a web hook call. Now we have a URL and this is the URL that we need to tell auto task to send um to to send its web hook to or to send all the information out as JSON to this particular web hook. I'm going to go back to our manage web hooks and we're going to say this is where we want you to send it to. Um and we're going to put our email address in here.

Oops. doesn't really matter. And we need to just give this a name. And what we can then do is when we hit create web hook, this is going to go ahead and it's going to go and create and allow us to pick which fields we want to trigger on and also which fields we want to include inside our web hook. So in here, I'm just going to say trigger on any field as well as any custom field. I also want to include all our custom fields and I want to include all of um our standard fields.

Now you don't have to obviously do this. You might only want to trigger when you know when the city is entered or you know when the when something is changed within the company. You don't necessarily want to trigger it on any field. I'm just doing that for the purposes of this. What you do want to do though is you do pretty much want to include everything.

So, even if you trigger on just one field, um you still want to make sure you're including everything. And in this case, you can see here I've got my add to Hudu plus all those other ones I've created. I'm just going to remove these actually cuz I don't want these included in my um in my output, but I do want my add to Hudu. And I'm simply going to hit save fields. And what you will see happen here in a little bit is you'll see that this says saving fields.

Please wait. This could take a moment. And it does take quite a little while inside um inside auto task because it is quite slow in terms of of getting it. Oh, it looks like that might not actually be. I don't know if you can see that now showing.

Let me just make this a bit smaller. There we go. So, this is this is kind of what we were really looking for in here. Okay. So, this takes some time.

What you'll see once this is created is we should see in our web hook section. We should see my web hook for NAN and it's going to trigger on any time a customer is uh created, updated or deleted. It's going to trigger this and it's going to send it to that URL that we defined inside um NAT. So if I go back to here, I can see fields are are created successfully and that is going to show me that they've all been um created successfully. Now what I can do is if I click back on manage web hooks and you then decide that later on you actually um you know you don't want this web hook to be triggering on all of these things.

Do you only want to trigger on certain things? Um, we can edit this, right? So, if I go problem with autotask, the API is super super slow. Just wait for this to do its thing. We can come back in anyway and you can edit and then just choose, hey, I don't want this field anymore.

Um, you do that. You simply hit save selections. And then what it'll do is it will actually then um not trigger on that field. Okay. So now that we have that working and we know that it's working in here and we can see that it is active and it is ready.

So it's ready to go. We know that when we create a customer inside autotask then what's going to happen is it's going to now go inside um N8N and it's going to hit N8 and we're going to get some information in here. So let's give this a whirl. create CRM account and we're going to say um my Hudu account. And here we're going to say add to Hudu is yes. I left my Hudu 2 there.

That's fine. And I'm going to give it a phone number. And before we do this, we want to make sure that we're going to listen for that event. So now we're listening on our web hook and we're listening for this event. And I'm simply going to hit save.

And what you will see this here um you may not have noticed but this was actually a play button when we first started like that and it turned into that kind of circle that means that it's accepted the or it listened and it received the information and here we can see this is our output. So what order task has given us is a whole bunch of stuff. We don't need to worry about any of this but what it has given us is this. So it's given us that this was a create. It's also given us the ID number.

Um, as well as that, it's also given us our company name and add to Hudu, it's given us our code. Now, the weird thing when it pushes the stuff into a web hook, what it's effectively doing here is it is creating um this weird like unique uh ID instead of the word yes or no. Um, but we can work with that. That's fine. So in this case 70 is yes and 71 is no.

So we're going to we're going to do an if statement inside um our n workflow to show that you know if it's equal to 70 then we're going to create it. If it's not equal to 70 we're not going to create it. So we're not going to create it if we say no basically. Right. So here we have all of our information.

So we know that that has now worked successfully. What we're now going to do um the way that N8N works is it's very workflow driven. So we're going to create another uh option in here on the workflow and we're going to say if now this is where we have to trigger on certain things. So we want to trigger where the add to Hudu is equal to this number. So all we're going to do is you can see here we've got our conditions.

So if we click on this add to Hudu and we simply drag it up to value one you can now see that it's giving the result of blah blah blah 70. So we want to tell it to say if if what we type in here is equal to this value then we're good. That's what we want to do. So we only want to trigger it where the userdefined field or this add to Hudu has this number against it. In other words, in this case, yes, we also only want to trigger it where and I think this is the option here where entity type is equal to account.

So I think it's called an account if it's um if it's a customer, otherwise it's called a lead or something else. So we only want to do this if it's a customer, right? We don't want to do this if it's um you know been created as a lead or something like that. Cool. So if we execute this step, you'll now see we've got this thing here called true branch.

So we can see that this is actually gone to the true branch because that these two basically match. So we do have a 70 in our output and we do have a an account in there. If we didn't if this was 71, in other words, this was no. So just to show you if I change this to 71 I now come down the false branch because it's looking at this saying well in your input or output whatever way you want to look at this it is the input and the input it says 70 and you told me to look for 71 so it's gone down a false branch. So, this is really important if you're doing ifs because then we can go if it's true, do this.

If it's false, do this. And we can kind of send it to different um make it do different things inside N8. Right. So, the next thing we now need to do is we need to get this in to Hudu. Now, N doesn't have a plugin to Hudu.

It doesn't have any of that kind of stuff. So we have to actually create it and we have to use the API in in Hudu to tell it that we want to actually um uh you know create the company. So in order to do that what we're going to do is we're going to come here into Hudu going to go to admin. You're going to go to API keys. It might be a bit I don't know if you can see where I clicked on but it's API keys.

I think it's way down at the bottom. I'll just move this a little bit. Um, so you should see that it is that it is API keys. Oops, my screen's gone all funny here. Hang on a minute.

Uh, right. I'm just going to make this a bit smaller. There we go. Okay. So what we want to do in here is you can see we have this API keys.

We're going to go and create our API key. And we simply going to say new API key. And let's call this N8N YouTube test. And we are going to hit create. And when you hit create, you will see that we have this key now created.

I am going to trash this. I know people are going to comment below saying, you know, you shouldn't really expose keys over YouTube. That's fine. I am going to delete it afterwards, so don't worry too much. Um, what we also need is if we now click on the API documentation, Hudu is going to tell us what we actually need to use in order to connect to this API.

So, we have to come into uh back into NAN. We're going to add a new node. And this time, we're going to make this an HTTP request node. And this HTTP request, come on. There we go.

This HTTP request is how we how we kind of use APIs and how we talk to any kind of API. Um, and this is why I like Nin so much because we can actually just connect it to anything we like as long as we have the API. So, in this case, we're going to make this a post because we're going to push information in to NAN, sorry, into Hudu. Um, we're also going to send some headers. So, the headers that we need to send, and it actually tells you in here, is that we need to put this thing in called X API key.

So we need to come into our X API key in here and then the actual value of the API key is that what we created earlier on. So it's this API key here. So we're going to simply copy this and come back into NAN and we're going to chuck this key into there. Cool. So we've got our headers.

So that is how we are going to authenticate effectively. We're going to do a post. and where are we going to post this to? So, from our documentation, we can see that if we come all the way down and we look for companies, oops, it's down here. Companies, we can do a post to companies. And the way we're going to post this, and I'm just actually going to also copy this body cuz we're going to need this body in a few minutes.

But what we're going to do is we come all the way to the top. It actually tells you that it's your domain, API, companies, etc. So, what we're going to do is we're going to copy all of this. Going to come back into NAN and we're going to under the URL, we are going to copy this. Sorry, just so you can see how I got that.

Once you click on the URL, you've got this tiny little um thing here that expands it and it makes it a lot easier to work with. So my URL is Sondela Consultinghuducloud.com. So I'm simply going to copy this and I'm going to come in here and just change this bit. And it's going to hit the companies cuz that's what we want to create. We want to create a company.

And then we need to send the body. And the body is what I created earlier on. Uh sorry, not what I created, what I copied here. So when I went into the API documentation and I came down to companies, I said I needed this body here because this is what we are going to send into Hudu from uh from inside N8. So we're just going to copy this and we're going to say the body content type is going to be JSON and it's going to be using JSON.

And then in here we're going to paste this information that we need. And now we can make this a little bit bigger. So when we edit this, you can see it makes it so much easier to use. Right? So this is expecting a name.

So the name in here is going to be obviously our first name. Uh sorry, our company name. So what you can do is if I posted this now, it's just going to create a company called string. It's going to create a company type called string. It's going to create an address called string.

It's going to create this company called string. We obviously don't want that to happen. So what we do from N8 is we look at whatever we received inside our web hook. So we still have all of that information. And now we should see in here we have company name.

So we're going to simply replace this word string. We're going to replace this with company name. You need to make sure that it goes uh okay. Sometimes it does this which is really frustrating. you need to make sure that it goes um in between these uh quotation marks. So, it's probably easier to make it a bigger screen.

So, click this little guy here, click on web hook, and then go to your company name. And we want to drag our company name into there. Um so, it says execute previous nodes for preview. And that's fine. It's because we have to actually trigger it again in order for it to pick up that information.

Uh nickname in here, we can just leave this as a null. We can leave company type as null as well. Okay. Then address line one. So auto task is going to have given us address line one which we have in here.

So, if we simply took the string and we drag address line one into there, yep, address line two and so on and so on. So, we're going to put city just so we get all of it, right? So, we're going to put city in there. We're going to put state in there. And we're going to put zip in my case is called postal code.

And then country name. If we wanted to put country in there, we can. I'm just going to leave this blank. Phone number. We do have the phone number field because it is a required field in um in Auto Task.

So again, we've got our phone number and we're going to add phone. And then last thing we probably want to do, let's get rid of facts. In fact, if you don't want something like fax number, um, you know, we can just simply remove the whole line. We may not want website or any of that kind of stuff. So we can just remove all of these things that we don't need.

And the last thing here in notes, we probably want to put something like created via auto auto task and NHN integration. You can put whatever you like in there, of course. Um, so that's it. So, we've basically taken all the fields that we've got from our our um uh web hook. We've brought them into here and you can see now if we close this down and we come out of here, we now have this node and it's automatically doing it against the true branch because we're saying only if these conditions happen.

So let's go and see if this works. So we're going to say waiting for trigger event. So, we're going to come into audit task and we're going to create a whole new company CRM account and we're going to say uh my Hudu company add to Hudu is going to be yes. Address one is going to be 1 2 3 first lane uh somewhere called city uh county is going to be uh cool county and postal code is going to be that. Yep.

And then our phone number is going to be whatever we put in our phone number. So, make sure that this is is working. So, you can see it's got this little um double-headed arrow. That means it's listening. And when we simply hit new account, just make sure that's all good.

Boom. You should see that that in a couple of seconds should change to like a little play button. Hopefully, it did. There we go. It's changed.

It now has an error. Okay. So now you can see there's an error in here. And I'm I'm glad that this error has kind of happened because it gives us the ability to see what's gone wrong. And it says the connection cannot be established.

And it means there's an incorrect domain value. And I can see straight away this didn't work because I have my double https in here. So let's just see if we can execute this step on its own. And boom. When we now change it and we hit execute step, what you can actually see has happened in here is we have my Hudu company uh all of the stuff.

So this is the output that has been sent into Hudu. Well, should we see if this has worked? Hopefully it has. And it has. There you go.

My Hudu company. We click on my Hudu company. And you can see we've got one two three first lane somewhere cool blah blah blah blah blah it's worked. So from an NN perspective um we have gone into auto task we've created the company in auto task we've then said once the company is created in auto task use a web hook send it into n and have n update Hudu automatically. So let's look at this the other way around.

If I now execute workflow and just to prove if this is actually going to work. If we now create a company and we say uh don't create in Hudu. Add to Hudu is going to be no. And we'll just put an address in here and a phone number. I always forget the phone number in order task.

In theory, what should have happened? You can see that this line for the false is actually highlighted. Um, and that basically says it hasn't come up here. If it had come up here and created this, this line would have been green. Um but if we look at it, if we actually go into the if statement, what we can see is it's come down the false branch.

And the reason it's done that is because this number here is a 71. And if we have a look, you should see that it's 71. And that means it's no. So what we can now do is we can do a bunch of other things. If if what you could do at this point, if it's failed to create the company because they haven't put the company information in there, you could actually do something like um and this is really cool.

If you're using say like Outlook, you could come in here and you could say what we're now going to do is we're going to send an email. Uh where is send an email? Send a message. Um, we're going to use our Microsoft Outlook account. Um, and you can see the account is connected.

So, when you click on Microsoft Outlook account in here, if it's not connected, it'll give you the ability for the Microsoft thing where you can go and connect it, make sure that everything's working. In my case, it is all connected. And then I'm going to say the operation is send. And I'm going to send it to um let's just send it to uh I don't care if you see this. Uh ah my at sign isn't working.

And this could be failed to and this is where it's really cool as well. Failed to create company create company in Hudu and the message could actually contain the name of the company. So you could create in here and you could say something like let's just make this bigger. So you could do something like the following company was not able to be created in Hudu. Yeah.

Um, and so what you can now do is this will send an email. If I execute this step, I got a success equals true. So let's go to gmail.com and let's do this one. And there it is. the following company was unable to be created in Hudu and I now have my email to tell me that. So, it's really super cool what you can do with NAN.

And now you'll see that this has gone down the false branch. I I can keep going, right? If I then said, well, after I've sent my message, I now need to do something else. I can come in here and I can maybe just do some AI around that. Um, or I can do, you know, something else.

Maybe I also want to then, you know, store it in Excel or convert it to a file of some kind or or, you know, merge it into something else. Whatever I want to do, I absolutely have the ability to do that. And this is why N8N is so cool and allows you to kind of write really super cool integrations um inside Auto Task. Now, what we want to do is let's call this at Hudu. Now one of the things you have to do here is when we save this we want to activate this.

However we activate this it says you have a different web hook. So the web hook that we are now creating is going to be different from the web hook that we um that we used before. So if we click on this you can see we've got this listen for test. So we got a test URL. We've also got a production URL.

So now what we have to do is go back to our production URL, sorry, back to our uh web hooks. And in this case, we want to change this to be our production URL. Okay, so it's now updated it. It's now got the production URL in there. And then what we can do is now it's it's using instead of it using the production URL, it's using that.

And now it says active. So what will happen now is we don't have to then keep clicking execute workflow and testing it and doing all these things. It just does that all for us in the background. And that's it really. That's this video.

I know it's gone on super long. What I want to do is I am going to make another video on you know checking here where we can use the same workflow to say this time we're saying you know when the company has been created um and you can see here um we have an action of create right so this action is going to be um an action of edit so we might want to have another one of these an a completely separate one that says when the company is edited in auto task then we want to have that company updated as well because you might want to have it when it's edited. And we're also going to do another one that's going to go the other way round as well. Um, so I am going to do some more videos on that that will say what happens when we create the company in Hudu. How do we get that company to automatically be created in Autotask?

But I hope that's been useful. I hope that's helped. I know it's been super long. I really appreciate you watching. If you like this content, you want to see more of this, please uh subscribe.

I will put uh everything we've talked about including N8N um you know as as well as the web hook stuff I will put into the description below. I would really appreciate a thumbs up and a like um and I'd really appreciate it if you can subscribe. So thank you so much for watching and I will look forward to seeing you on the next video. Chris out.

Want help putting this into practice?

Get in touch and we'll talk through how it applies to your MSP.

Let's Talk

← Back to all content