Overhauling ShotGrid Statuses With Webhooks
I overhauled the status workflow here at Baked Studios. I thought I’d share for those curious about how some studios manage statuses. We’ve linked Version statuses to Task statuses to Shot Statuses. The thinking behind this is as follows: Shot Statuses are an overview status — used for clients and producers. Task statuses are used by Coordinators and Artists to communicate well, task status, and then version statuses are used mainly for the review process by Artists and Supervisors. Since people bid shots, track tasks, and review versions — this all seems to make sense to me.
Often, you'll find that the status of a task is contingent on the status of a version linked to that task. And the status of a shot, contingent on the statuse of a task linked to that shot. So we linked everything up using SG's webhooks interface and a service hosted on firebase. Here's the general mapping we use with some categories to help make sense of things:
🤖Here's the full repo for the webhooks service👾
Webhooks Firebase Application
Functions are hosted on firebase and endpoints can be reachable by setting up ShotGrid's webhooks workflow.
This repo is full of code ported from @sinclairtarget who did the original work for hosting on a windows machine on prem.
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:
Please refer to firebase docs for info on first time firebase initialization.
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
-
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"
} -
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
-
Log in to Firebase:
firebase login
-
Initialize Firebase (if not already done):
firebase init functions
-
Deploy functions (Gen-2):
firebase deploy --only functions