🚀 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
- 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.
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
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
-
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
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.
-
Log in to Firebase:
firebase login
-
Initialize Firebase (if not already done):
firebase init functions
-
Deploy functions (Gen-2):
firebase deploy --only functions