Skip to main content

Test your knowledge: Build your first automation with Magical

Build your first automation using basic Magical features.

Written by Sam B.


Goal

Build your first automation using basic Magical features. The automation will check the weather for a location of your choice, and compare the weather against a temperature of your choice. If the weather is cooler than desired, the automation will navigate to Google Flights and return flight information to Cancun, Mexico.

Guidelines

  1. Use the startingURL to have your agent begin at https://www.weather.gov/.

  2. Use inputs to set a location and temperature for your agents to use.
    Hint: add descriptions and regex to your inputs so that they match the intended format for the automation.
    Learn more about inputs

  3. Use the click, and clickFill commands to click through the weather page and search for the weather forecast for your inputted location.
    Learn more about commands

  4. Use a branch agent to determine if the weather in your desired location is warmer or cooler than your preferred temperature (which should have been inputted at the start).

  5. If the weather is cooler than desired, create an agent that goes to https://www.google.com/travel/flights?gl=CA&hl=en.

  6. Use the click, and clickFill commands to fill in the form on the Google Flights page, and find flights from your location to Cancun. Set the dates of departure and return to today’s date and a week from today, respectively.
    Hint: if the page is slow to load, use the wait command to pause the actions of the agent until the page is ready.

  7. Use the reportStop command with a defined output to return the following details about the first flight on the page: flight duration, whether the flight is direct, cost of the flight, and departure time.
    Hint: consider using an object as an output.
    Learn more about outputs

Testing

Use the Try It feature to test out the automation in Draft mode. Try running it with several locations, and several temperature inputs. Consider testing it with a preferred temperature input that is both cooler, and warmer than the current temperature to ensure your branching is implemented correctly.

Did this answer your question?