Help bypassing error code 400: Agent not found

Hey guys this is my first post and I’m happy to be here!

I have an automation that’s run into the error code found in the topic. However, the “Launch a Phantom” ID matches the “Watch an Output” module but, the “watch an output” doesn’t capture the actual output. Please refer to the screenshots for more context as the Bundles do match.

I’m not sure what I’m missing but I’m trying to connect the two correctly so the rest of the automation flow works properly. Any help would be greatly appreciated!



Hello!!

Welcome to the Make Community!

You seem to be doing well; 1 scenario to start the phantoms, and I to get the new results.
I’m not sure I get correctly your question, but if it’s about the fact that you don’t see the result the second time you test, it’s because you are using a “Watch” Module.
These modules are used to detect a new item in the source application. So, when your scenario runs, it only picks the new. In this case, the new Outputs.

But when you design your scenario, you may want to test again and again. One way to do it is to use the “choose where to start” option.

2024-06-19_18-12-46 (1)

If I misunderstood your question, can you please be more specific?

Benjamin

1 Like

Hey Benjamin, thank you for the welcome and my apologies for getting back to you so late. Thank you for your advice - when I ran it a second time but, having restarted the workflow from the beginning, the “launch a phantom” module connected with the “watch an output” module. Because of your advice, I finally understand that the “watch an output” module will only work if “new data” comes in!

Quick follow-up: Despite the two modules connecting, the “Download a result” module doesn’t generate the results captured in Phantom Buster and place it inside the Google Sheet module “create a spreadsheet”. The only thing it maps is the file name. I’m assuming the results have to be mapped out in the “create a spreadsheet module” under the Sheets tab → click map → perhaps put in the “output” dynamic variable from the “watch an output” module?

Would really appreciate your input :slight_smile:

1 Like

Hey! It’s really not an issue you take time to answer, it’s the case for me as well :wink:

I used once phantombuster but I don’t remember exactly how it works.
But when you did your first screenshot of the result of Watch an Output, there seemed to be an « output » data. If there is nothing inside, you may really need « download a result ».
Anyway, what you say is right. « Create a spreadsheet » won’t be enough, it will only create an empty spreadsheet.
You will also have to add rows to your spreadsheet with all the data coming from your phantombuster result.
This will introduce possibly more complex concepts in Make, such as Bundles and Iterators.

I can try and help you. Could you please try and show me the content of «output » from Watch Output or the result of « download an output »? I want to see what it looks like.
Also can you show me an example spreadsheet you want to create?

Also: it looks like you want to create a new spreadsheet every time you have a new phantombuster, right?
If ever you want to store all results in a single spreadsheet, you will no longer need Create a Spreadsheet, but only Add a row.

Benjamin

1 Like

Thank you Benjamin! I created a video walking through my current process as well as the outputs for both “watch an output” & “download a result” modules. If Bundles and iterators are requirements for processing the data from the download a result to create a new spreadsheet module, I’m always happy to learn!

Thanks again for all the help! Look forward to your response :slight_smile:

1 Like

Hey!!

Thank you so much for your video!!! I really appreciate the effort you made to explain everyhing! it’s super clear!

So, here are my remarks :slight_smile:
you did well to grab the result, using the Watch and then Download a result.
The “Data” you see is in Encoded format. To transform it to a JSON string, you need to use the toString() function of Make.


The function is here

If you run this, you should get an Array with all the records that were found. I couldn’t test on my side, since I didn’t manage to refresh the cookie in Phantombuster, so my Json is empty :sweat_smile:

Can you try it, and show me the output of the Parse JSON? It will help me figure out what you next need to achieve.

For the Google Spreadsheet, what you showed “sheet” is the list of sheets you want to create in the spreadsheet you are creating; it’s useless in your case.
And you did well; maybe later you could create from a template in order to have a header, even if you could create one manually from Make… But let’s first try and fill the rows :sunglasses:

So, you will be able to keep the Create a Spreadsheet, and you will add a sheet called “data” or what you want


Example

Then you will need an Iterator, and a Google Sheets / Add a Row. The iterator will be used to split items in your Json Array into Bundles: and then Add a row will be executed for each item.

Add a row will use the ID of the spreadhsheet you just created


It will look like this

your “Drive/Upload a file” is useless.
At the end you may need to Move the new spreadsheet, but let’s see this after.

So, first, can you try the Parse JSON with toString() and show what the data looks like?

Cheers!!
Benjamin

2 Likes

Hey again Benjamin, hope you’re doing well!

I’ve attached the screenshots for the JSON Parser here. As you’ll see, the JSON parser produced outputs and when clicking on the Google Sheets “create a new spreadsheet” module, a new Dynamic variable called “resultObject” appeared which I’m hoping is another right step towards the end of the automation!

Looking forward to reading your next steps :slight_smile:



Hey!!

ah! that sounds good!! :slight_smile:
In fact, apparently, the result is a JSON that contains a Json :sweat_smile:
So, you need a second Parse Json after the first, and you have to map this ResultObject.
This should produce an array that contains your data!

Once this is done, you can leave your “Create a Spreadsheet” and don’t forget to add a new sheet that you call data.

After the Create a Spreadsheet, you will need an Iterator… and then Google Sheets / add a row.

But first, can you add the second Parse Json and map resultObject to see if it’s parsed correctly?
If it worked, can you show the output (I need to see the array and the content of one item of this array).

Also, set your scenario to OFF; it’s ON right now, and since you didn’t finish building it, you should not set it to ON

Benjamin

1 Like

@Diego_Armas_Morales,

I know what will happen, watching the output you showed!

The second Parse Json will generate multiple bundles, which is good because you won’t need any Iterator!

BUT, you should follow this order:

  • The first JSON stays where it is
  • Then, keep the Create a Spreadhseet
  • Then, add a second Parse Json, and map resultObject
  • Then add a Google Sheets / Add a Row => That one will need you to map the data you have in the bundles. And you will have to map the ID of the document created in “Create a Spreadsheet”, Sheet name “data” (don’t forget to set it in Create a Spreadsheet).
  • remove the updload a file

Benjamin

1 Like

Thank you Benjamin! I’ve updated the flow as prescribed - the second JSON Parser is where I’m failing to map the array of contents. I created this quick walkthrough video updating you on the happenings but please let me know where to go from here when you can :slight_smile:

Hey!

First of all, for the create a spreadsheet, the « sheet » should be « data », meaning you type « data », not a mapping. It’s the name you give to the sheet in your spreadsheet. Spreadsheets can have multiple sheets (usually tabbed), and you explicitly say you want to name it « data ». Then in Add a Row, in the field «sheet name » you type « data » as well.

In other terms, you are creating a spreadsheet that contains a sheet called « data » and you fill this « data » sheet with the result of phantombuster.

Then, for the second JSON, it should not fail; there is no need to add any data structure. Have you checked the output of the first JSon module? Maybe this time your resultobject was empty?

The rest is fine, you are at 90% of success :grin:

So: check in the failed execution of the output of the first parse json contains info in the resultobject, if it contains data, it’s another issue, but definitely not the data structure.

And yes you are absolutely right, once the second parse json is successful, you will have the fields you can map to Add a Row :blush:

1 Like

So Benjamin, I got the 2nd JSON to parse the JSON from the 1st module and I started almost tearing up in happiness (please see screenshots).

Once it all passed through, I mapped out the values in the Google Sheets “Add a row” module, pressed ok, and I don’t think I pressed “save”? Or maybe I did? But regardless, to test out what a thorough workflow would look like, I added a new URL to the first module from the first workflow and ran it from there. All the subsequent tries, despite not having changed anything, all come back as errors at the 2nd Json parser module with the same message: " * Missing value of required parameter ‘json’." The same error message has been generated the last 5 runs.

I’ve attached a screenshot for your reference but if we can bypass this, I think the flow will finally be complete :tired_face: :sob:



Hey!

Don’t worry, we’ll make it work! :slight_smile:

Let me give you a few tips and remarks:

  • first of all, it looks like you always set ON your scenario to test it, and wait the scheduler to start it: it’s not the way to do; because you have to wait, and because, since you are not in the designer, it won’t grab any field/metadata from your module. => your scenario has to be OFF all the time you work on it, until it’s ready (and then you can turn it ON).
  • When your scenario is OFF, and you want to test it, you have to click the “Run Once” Arrow; it will start, execute all steps (until it fails or doesn’t need to process anything else) => This will grab all metadata.
  • When you design the scenario, you should do step by step, adding the new modules only when you are sure all the others are fine. For instance, the last step “Add a row” should not be here until you are sure the last Parse Json works properly :slight_smile:
  • For the error you get, as you say, it worked once, and then never again; it’s because all the other times, resultObject is empty, maybe because the Phatombuster’s Container didn’t return any result, or you ran out of credits or your session cookie is expired. You need to add a filter to stop processing when it’s empty, and go through the whole scenario only when there is data in resultObject; like this it will never fail again. (let me show you below).

Let’s fix your issue! :blush:

For your recurring Json error


As you can see here in my example, I had the exact same error; it’s because the resultObject is “empty”. Let me add a filter to avoid any error


The way I built the Filter stops processing when there is no result. I go to the next step only when resultObject is NOT empty.
You have to add the same filter between the first Parse JSON and the Create a Spreadsheet

For the last step
You’re almost done! As soon as you manage to generate a new ContainerID with data in resultObject, and that you tested with “Run Once”. The last Parse JSON will have parsed the metadata. So, when you add the “Add a Row” module, and select the columns A, B, C, etc. The pop-up will show you the fields coming from this last Parse JSON; you’ll be able to map everything.
But first, you need to figure out why you get empty results from Phatombuster.

To summarize

  • Keep you scenario OFF all the time until it works properly.
  • Use Run Once everytime you test the scenario
  • add a Filter after the first Parse Json to stop processing when resultObject is empty
  • add the last step only when you managed to Parse the resultObject and you can see Bundles with all the data you need.

Let me know the outcome :slightly_smiling_face:

1 Like

Good morning Benjamin,

I just wanted to come back here and let you know I’m infinitely thankful for all your patience and help!! I was able to complete the automation thoroughly with your help :slight_smile:

If you have any advice on how to make the name of the file dynamic in the “download a result” Phantom module, I’d really appreciate it!

For testing purposes, we hardcoded the file name as “Data”. As you can see in the screenshot, Phantom module does provide a dynamic value for this which goes to “File Name” but it only provides “result.json” as the value instead of being a dynamic name each time the download is made. If this is a Phantom Buster related query, I’ll look there instead. But again, super super thankful Benjamin!!


h

Hey!!!

With great pleasure!! You know, it’s super pleasant to help others, I love it!

Yes for the name you could for example directly type a fix name like « profiles » and then the variable now, formatted with a parseDate function. Like this it could look like « profiles-24_06_24 » for instance.

Like this

Best regards

Benjamin

1 Like

Unreal! Thank you so much as always Benjamin. I wish you nothing but the best!! I hope I don’t bother you or the rest of the community too much but for my first automation, I couldn’t have asked for better guidance!!

1 Like

Thank you! With great pleasure @Diego_Armas_Morales! Anytime if you have other questions!

Benjamin

1 Like