Skip to content

camerontarget14/shotgrid-status-webhooks-firebase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

shotgrid-webhooks-firebase

🚀 Ported Webhooks application from @sinclairtarget who did the original work for hosting on a windows machine on prem.

Functions are hosted on firebase and endpoints can be reachable by setting up ShotGrid's webhooks workflow.

Firebase Docs: https://firebase.google.com/docs/cli

Features

  • task_webhook: Handles ShotGrid Task status change events.
  • version_webhook: Handles ShotGrid Version status change events.
  • version_created_webhook: Handles ShotGrid Version creation events.
  • Local Testing: A main function for testing via the Functions Framework.

Project Structure

functions/
├── config.json            # ShotGrid & secret token configuration
├── status_mapping.yaml    # Version statuses & task relations
├── requirements.txt       # Python dependencies
├── main.py                # Cloud Functions entrypoints & dispatch logic
├── .firebaserc            # Firebase project settings
├── .gitignore             # Ignored files
└── venv/                  # Python virtual environment

To make changes:

Get to the right place:

cd functions

Create environment:

python -m venv .venv

Activate environment:

.venv/bin/activate

Grab those dependencies:

pip install -r requirements.txt

Deploy:

firebase deploy --only functions

Logs:

firebase functions:log

Configuration

  1. Copy config.json and update values:

    {
      "SHOTGRID_API_KEY": "<your_api_key>",
      "SHOTGRID_SCRIPT_NAME": "<your_script_name>",
      "SECRET_TOKEN": "<your_secret_token>",
      "SHOTGRID_URL": "https://your.shotgrid.url"
    }
  2. Adjust status_mapping.yaml to match your ShotGrid status keys and labels, and define any task-step relationships:

    version_statuses:
      - key: na
        label: N/A
      - key: stcomp
        label: Step Completed
      # ... more statuses
      task_step_relations:
      Rotoscoping:
        triggers_on_status: stcomp
        update_steps:
          - Composite
          - Secondary Composite
        new_status: bfr
      # ... more relations

Usage

Check endpoints based on Firebase configuration.

  • task_webhook: Deployed URL /task_webhook receives task status change webhooks.
  • version_webhook: Deployed URL /version_webhook receives version status change webhooks.
  • version_created_webhook: Deployed URL /version_created_webhook receives new version creation webhooks.

Each endpoint verifies the SECRET_TOKEN header, parses the JSON payload, and dispatches logic to ShotGrid per status_mapping.yaml rules.

Deployment

  1. Log in to Firebase:

    firebase login
  2. Initialize Firebase (if not already done):

    firebase init functions
  3. Deploy functions (Gen-2):

    firebase deploy --only functions

About

Webhooks server listening for changes on SG to Version, Task and Shot statuses that are mapped to eachother.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages