Managing my custom scripts

This walkthrough will guide you from the creation of a script to its public release into the catalog of your org.

πŸ“˜

Managing your scripts

You can manage your scriptscript - The source code that will be executed by NodeJS in the cloud, using Puppeteers, Buster library, and more.s in your Developer's page . You can also access this page through the navbar's dropdown menu.

This walkthrough will guide you from the creation of a script to its public release into the catalogcatalog - An org's catalog is page listing the scripts owned by that particular org. Each org has a catalog accessible at an URL following this format: phantombuster.com/<org_slug>. For example, Phantombuster provides a public catalog of scripts at https://phantombuster.com/phantombuster. Your catalog is accessible through your developer's page, under the link "Org Store" of your orgorg - When you sign up for an account on Phantombuster, an org is automatically created for you. It contains the agents you'll use and the scripts you'll code. Your org contains your catalog of Phantoms that you can share or not. e.g., Phantombuster's catalog is public.. In case you get lost during this tutorial, please refer to the video summary of this guide.

Set up a new script

Under your developer's page, you will find a "Create script" link: click on it and set a name (no extension needed).

Branch your script into "master"

You now need to attach your script to a branch. On your scriptscript - The source code that will be executed by NodeJS in the cloud, using Puppeteers, Buster library, and more., open the management menumanagement menu - This is a dropdown menu that you will find in many places on Phantombuster, it appears as clickable three little dots. Clicking on those will provide you various management options on the associated entity like deleting, renaming and so on... and click Branch into.... You will be asked for a name, let's keep it as default: "master".

Code your script

πŸ“˜

About code

Please refer to our complete guide on how to write custom scripts for detailed instructions about code.

Head to your script's page, open your scriptscript - The source code that will be executed by NodeJS in the cloud, using Puppeteers, Buster library, and more.'s management menumanagement menu - This is a dropdown menu that you will find in many places on Phantombuster, it appears as clickable three little dots. Clicking on those will provide you various management options on the associated entity like deleting, renaming and so on..., and click Edit code. In our editor, you can write any JavaScript you want, we will execute it from the cloud!

Here is a simple HackerNews scrapper to start with, taken from our developer quick start.

// Phantombuster configuration {
"phantombuster package: 5"
"phantombuster command: nodejs"
"phantombuster flags: save-folder"
// }

const Buster = require("phantombuster")
const buster = new Buster()

const puppeteer = require("puppeteer")

;(async () => {
  const browser = await puppeteer.launch({
    // This is needed to run Puppeteer in a Phantombuster container
    args: ["--no-sandbox"]
  })
  
  const page = await browser.newPage()
  await page.goto("https://news.ycombinator.com")
  await page.screenshot({ path: "screenshot.png" })
  await buster.setResultObject({ pageTitle: page.title() })
  await page.close()
  await browser.close()
  process.exit()
})()

Once you are done coding, don't forget to Save your updates.

πŸ“˜

SDK

If you don't want to use the built-in script editor, you can use our SDK. See this guide about automatically publishing code to Phantombuster for more details.

Test your script

Your code now lives in the staging environmentenvironment - Each branch is composed of two distinct environments: "staging" and "release". Having two environments is really useful when you want to update a script without breaking the agents running in production. You can release a script in your developer's page once you are done modifying it. of the script, where you can test your scriptscript - The source code that will be executed by NodeJS in the cloud, using Puppeteers, Buster library, and more.. Click Use this Phantom and go through the setupsetup - The multiple section setup for configuring an agent. It is usually composed of three steps: (1) the input you'll need from the user, (2) the launch settings like the frequency and (3) the notification settings. A setup can be accessed through its agent's management dropdown.. You are now on your agentagent - An agent is an "instance of a script". It can be configured through its setup. An org's agents are listed in its dashboard. Every agent has its own page, where you can see details about the previous launches, debug your script live and so on...'s page.

Before launching it, you might want to debug it: open your management menumanagement menu - This is a dropdown menu that you will find in many places on Phantombuster, it appears as clickable three little dots. Clicking on those will provide you various management options on the associated entity like deleting, renaming and so on... and click Toggle console . You can now launch your agentagent - An agent is an "instance of a script". It can be configured through its setup. An org's agents are listed in its dashboard. Every agent has its own page, where you can see details about the previous launches, debug your script live and so on... and see it run live!

Video summary of our work so far!

Here’s a summary of what we did until now: 30 seconds from creating to running, would you believe that?!

Release your script by changing its environment

Once your scriptscript - The source code that will be executed by NodeJS in the cloud, using Puppeteers, Buster library, and more. is ready for release, you can go to your developer page and follow this release process:

  1. Select the desired branch, you should be on master, so nothing to do!
  2. Check the box(es) next to the scriptscript - The source code that will be executed by NodeJS in the cloud, using Puppeteers, Buster library, and more.(s) you want to release
  3. Click Release!

Share your script by changing its visibility

Your scriptscript - The source code that will be executed by NodeJS in the cloud, using Puppeteers, Buster library, and more. can be shared and used by other Phantombuster users. You will find options to change the visibility your scriptscript - The source code that will be executed by NodeJS in the cloud, using Puppeteers, Buster library, and more. in its page, under its management menumanagement menu - This is a dropdown menu that you will find in many places on Phantombuster, it appears as clickable three little dots. Clicking on those will provide you various management options on the associated entity like deleting, renaming and so on....
We have 3 types of visibility:

  • private: only users within your org can access your scriptscript - The source code that will be executed by NodeJS in the cloud, using Puppeteers, Buster library, and more. (default value)
  • public: all the users can use your scriptscript - The source code that will be executed by NodeJS in the cloud, using Puppeteers, Buster library, and more.
  • open source: all the users can use your scriptscript - The source code that will be executed by NodeJS in the cloud, using Puppeteers, Buster library, and more. and see its source code

Setting your scriptscript - The source code that will be executed by NodeJS in the cloud, using Puppeteers, Buster library, and more. to either "public" or "open source" will make its page accessible by others and it will appear in your catalogcatalog - An org's catalog is page listing the scripts owned by that particular org. Each org has a catalog accessible at an URL following this format: phantombuster.com/<org_slug>. For example, Phantombuster provides a public catalog of scripts at https://phantombuster.com/phantombuster. Your catalog is accessible through your developer's page, under the link "Org Store". Don't forget to release the script for the modifications to go live!

πŸ“˜

Support

If you have any questions about the creation of scripts, please tell us using the support button πŸ™‚

Updated 2 months ago


Managing my custom scripts


This walkthrough will guide you from the creation of a script to its public release into the catalog of your org.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.