hey Daniel here in today's video I'm going to show you how you can integrate mid Journey with your make.com automations mid Journey doesn't have an official API so you'll need to use an unofficial entry point in this case we're using go API to gain access to the system there are two ways to generate images with mid Journey via go API the first way is to use your own mid Journey account so with this bring your own account option you bind your account to go API and then any requests to generate images are just relayed through go API servers this way you're not paying per image generation but you do have to pay $10 a month to have this option the second option is to use go api's own mid Journey accounts and with this approach you're just paying per image generated so it's a pay per use model and here you can see the supported functions that are available with go API and mid Journey so you can imagine new images based on a prompt upscale images create variations in Paint Zoom pan all of the functions that you would be familiar with within mid Journey's own interface we're not affiliate with Co API but we have used this platform before for some of our other automations and we've been pretty happy with its performance that being said unofficial apis are never going to be as reliable as official apis um so you can't really expect a 100% up time with these so to get started click try API for free and that'll bring you into your dashboard and you can see all of the various services and models they have on the left hand side so we'll just click on Mid journey within this they have a playground where you can test out some different prompts so for example a cute puppy and then you can click run and as you can see that generation a 200 Response Code which means it has successfully posted the job you get your task ID here and then you can click run here to retrieve the task results so you can see your images generating it may take a few minutes click here to update your task progress there we go there's the images and with mid Journey you get four different variations of images so then you would need to run the upscale function to actually increase the resolution of one of these images and you can see the response that you're getting from that get task call there as well so we're going to be doing all of this in make.com but it's good just to see how the system actually works you need to trigger the request you need to wait a period of time and then you need to get the task or get the results there's information then on the types of functions that you can use based off the versions of mid journey and then the different costs per function as you can see there there's also a full task history which is great because if you need to troubleshoot or debug any issues you're having with generating images you can see did the call fail and maybe it was a case of a specific call may have taken too long to actually return so you can see that that call that I just triggered took around 32 seconds to actually respond and and under API settings you can see that we're currently in Pay Per use if you wanted to bring your own mid Journey account you could click on this you would switch to that mode and then you would need to follow the instructions to bind your mid Journey account to go API so we'll leave it at pay-per use for the moment if you click run API you can get the full API documentation for this endpoint so we'll be hitting this task API and you can try it out here as well so you can see that this is the prompt that's been passed so this is a flying night City so what we need to do is copy this body out and put it into a HTTP request Within make.com okay so let's get our scenario set up so log in to make and create a new scenario if you'd like to get way ahead in your AI automations then check out the link in the description to our community the AI automator where you'll be able to access this mid Journey micro template we also run lots of live workshops to help members out we have courses we have lots of templates we'd love to see you here so check it out below so first things first we need to use this HTTP make a request module and then we just need to copy in all of the information from the documentation so this is the Imagine request we going bring that into there we're going to post to this request be sending in a raw Json so you can choose that there and if we come back in here we have this body so we can copy this out and just paste that in there if you use contrl V you kind of end up with this kind of mess of white spaces so if you delete that out and just paste as plain text it's nicely formatted and easier to read so the model is M Journey the task type is to imagine and this is the prompt now obviously this is hardcoded so if we just save that for a second maybe let's just add a module here we'll set a variables and this can be our image prompt so we'll put that there now when you actually set this up as part of an automation maybe the image prompt will be coming from an air table or a Google sheet or maybe chat GPT or an llm is generating an image prompt for an new article for example whatever the use case is so we have that in here now so let's then remove this out and put in our new variable which is that one we'll leave the aspect ratio on the process mode as is for the moment now go API do support web hooks it's definitely a better approach to use web Hooks and I've done that in some of my other go API videos for the moment I'm not going to use that and I'll just put in asleep for 60 seconds so that is the image prompt and that's trigger image generation so okay let's save that now let's run this yeah we haven't passed any authorizations so let's have a look so let's see what headers we need to pass so we have X API key so get that there and then we need to get our API key so this is set on the bottom left API keys so your API key appears here if you don't have a copy of this you can just click reset key it'll provide it to you in plain text which you can copy I'll cycle this key after this video and then you can just paste it in there so let's try that one now save and run it okay so we have all Green Let's have look I forgot to parse the data so come back in here and just click parse response and do that again because we need to be able to use the task ID when we're going to to fetch the results of that task okay so that's better so here's data data and then you can see the task ID and under output nothing is appearing yet because the task is pending as you can see there so next up we're going to put in a sleep module this really isn't the best approach um polling or web hooks are a better approach so the problem here is if we put in say 60 seconds and if the generation of the image takes longer than 60 seconds in mid Journey or on go API servers then this scenario will either encounter an error because the image doesn't exist when we go to fetch it or it won't trigger an error but the image won't be saved so it's obviously not ideal so there are better approaches I'll leave links in the description below for how to set up web hooks with go API and also how to use polling in make.com which uses a repeater to constantly check to see has the task succeeded and if so we can kind of continue along its path there isn't native polling in make.com but that repeater trick works pretty well for the moment though I'll leave it just as a 60-second sleep just to show you how this works so next up we need to fetch the results of this task and if you come into the documentation here you can see that we've just triggered this imagine function but we now need to use the get task on the bottom left here so if you copy that out and then we'll come in here create another make a request module and we'll paste that in there you can see task ID is a variable but we need make.com to actually populate that out so if you delete that and then just come into here and you'll see task ID and just drag that in there so this is a get request you can see get we do need to pass in our authorization again so we'll come into here and then the name is X API key and again we just need our API key which is this one so we paste that in there and I believe that's it we do want to parse the response again so let's save that now you could run the whole scenario again but what I might do is just if you press this bubble you'll get the data from the last execution run so we'll just do that just to get the task ID which which is this one so if you copy that out contrl + C and then if you right click and click run this module only um you'll be able to get this task that we just created which is this one so we'll do that and this is the result we have data data and then you can see the status is completed we have an output and there is the image URL and let's have a look and there we go there are the four Images two of which are quite realistic the other two are quite stylized but yeah it looks pretty cool so next up let's upscale each of these images and save the results to a Google drive folder so back into make.com just rename some of these so that is weight this one is fetch images so here we are going to use a repeater because there are four images in the mid Journey response and we want to upscale each of those images So within the repeater then we're saying run this four times it starts at one and it stops at Four okay we can add another module then another request and this one then is going to trigger the upscale API which you can see there so let's copy that out now it's the same end point we're just passing a different task type so actually what I could do let's delete that and just clone this because it's the exact same endpoint we're just passing a different body so we'll call This One upscale so the API key staying the same again it's just a different body though so we'll come into the upscale documentation and you can see here the body that we need to pass so just copy that out and paste it in there again paste as plain text now you can see it needs a task ID An Origin task ID so we have that from the previous module we have that here well we have that from both modules in fact so you can delete that out and just grab it from one of those modules and then the index that you need to pass is which number which image these are numbered 1 2 3 and four and because we're in a repeater we can just use the index of the repeater which will be 1 2 3 or four so we can drop that in there and that's it save it and again we now need to put in a wait because go API and mid Journey are going to take time to actually upscale the image so we'll just wait for another 60 seconds so that one is there and then we just need to fetch the image again it's the task end point passing an ID using the get method so we can just clone that module we'll rename it to fetch upscaled image now the only thing is we're not using the original task ID we need the task ID from here this is module 8 as you can see so what to do then is just delete out that and put in the task ID from module 8 now we haven't run this yet so you can see that I'm not getting this little arrow to download the data now what we could do let's just cancel that because we know this is the exact same structure as the first module you could copy that out and then in notepad just paste it and just change the number of the module so this is number eight so just change that to number eight and then you can put that in there now it's not going to be solid blue in this case because it doesn't know this data exists but we know the data exists because it's literally the exact same endpoint it's hitting so it is the right data structure okay so we can save that so we'll click run once and we're triggering the generation of four new images I'm going to wait for 60 seconds fetch the image and then we'll trigger the upscale of the four Images now I'll stop it after the first one because we still need to save these to Google Drive okay so the requests for the upscaling of the first image has happened we have got our task ID which is there and the status is pending so the image is generated let's have a look at it status is complete here's the output and there you go there's our flying night City that looks pretty cool okay so let's stop it there it's currently upscale the second image because what we want to do is save this to a folder on Google Drive so I've created this test folder that you can see here so what we'll do is type in Google Drive and let's see we need a upload a file which is there then you can choose the folder so I'll just choose that test folder I just created created now we need file name and data so what we need to do is download the file so that we can provide the data to upload the file so let's just save that for a second come back in here and add a module and under HTTP there is get a file so what this is doing is it's going to download this mid-journey image to make.com server and then you'll have it in binary format to provide to this Google drive module so if you click on URL and then within this module which is module 10 just click on data output and image URL and then it's going to download that image so this is download to make and then this one is upload to drive and from here then we now know that make will have the binary and well it's even better it's even already selected it so HTTP get a file and that's it you can save that and now let's do one more test so click run once okay so that has worked let's have a look at Google Drive yeah we have file. PNG brilliant there's our image now I think the issue is file. PNG might be overwritten the second time because it's kind of a generic name so let's stop this and then let's open up here we might just override the file name with the index so let's change this up we'll remove that and then maybe add the task ID and then Dash the index of the repeater so at least it's going to be specific to this image number um PNG so I think that one should do it okay and just run it one last time and that should work okay that's uploading again and here we go so yeah the file name is now the task id-1 because it's the first image PNG so that's pretty much it that's how you can trigger mid Journey image gener generation using make.com and go API how you can upscale those images and save the results to Google Drive if you have any questions on that just leave a comment below if you'd like to get way ahead in your AI automations then check out the link in the description to our community the AI automator where you'll get access to our make.com and NN course we run a number of different events every week where we can provide Live support to members we have an active discussions board as well as lots of different system templates and micro templates including this mid Journey one so check out the link in the description to that thanks for watching and I'll see you in the next one