Skip to content
English
  • There are no suggestions because the search field is empty.

Managing and Deploying HubSpot Workflow Automation Scripts

This article provides a step-by-step guide to accessing, modifying, testing, and deploying HubSpot workflow automation scripts using PowerShell, WinSCP, GitHub, and CRON scheduling.

1. Access the Server via PowerShell

To access the server and navigate to the workflow directory:

  1. Open Windows PowerShell as Admin.
  2. Enter the following command to connect via SSH:
    ssh administrator@192.168.1.138
    1. Enter password.
  3. Once connected, navigate to the companySync directory:
     
    cd /home/administrator/companySync

2. Download and Modify Files Using WinSCP

To safely modify workflow files:

  1. Open WinSCP and log in using your credentials.
  2. Download a copy of the file(s) you want to edit.
  3. Make the necessary modifications.
  4. Follow part 3 for testing.
  5. Save a local copy of file you want to overwrite (just incase).
  6. Upload the updated file(s) back to the server and overwrite existing.

3. Test Workflow Scripts in PowerShell

Once the modified files are uploaded, test the script execution:

sudo python3 <file_you_want_to_run>.py
  • Replace <file_you_want_to_run> with the actual filename.

If the script runs successfully, proceed to push changes to GitHub.


4. Push Changes to GitHub

If the modifications were successful:

  1. Navigate to the local repository.
  2. Add and commit the changes:
    git add .
    git commit -m "Updated workflow script"
    git push origin main

5. Replace Files if the Script Fails

If the test fails:

  1. Open WinSCP.
  2. Re-upload the original or a corrected file.
  3. Re-run the script in PowerShell to verify the fix.

6. Scheduling a New Script in CRON

If you have added a new script, schedule it to run using CRON:

  1. Open PowerShell SSH and navigate to:
     
    cd /home/administrator/companySync
  2. View the current CRON jobs:
     
    sudo crontab -l
  3. Edit the CRON job list:
     
    sudo crontab -e
  4. Add the new CRON command (example for a Python script running at 10 AM, Monday to Friday):
     
    0 10 * * 1-5 /usr/bin/python3 /home/administrator/companySync/updateDeals.py
  5. Save and exit:
    • Press ESC, then i to enter Insert Mode.
    • Paste the new CRON command.
    • Press ESC, then type :wq to write and quit.\
  6. Note: Files using CRON should have their outputs to a specified file in the directory:
    1. /home/administrator/

7. Verify CRON Execution

To check if the CRON job is running correctly:

grep CRON /var/log/syslog
  • This will display logs related to CRON execution.

 

Final Notes

  • Always test scripts before deploying them.
  • If issues arise, check the CRON logs or manually execute scripts in PowerShell.
  • Ensure GitHub commits are up to date to maintain version control.

This process ensures smooth management of HubSpot workflows while maintaining server integrity and automation schedules.