Skip to content

Instantly share code, notes, and snippets.

@patrickwolf
Created November 8, 2025 14:56
Show Gist options
  • Select an option

  • Save patrickwolf/9adc16c09c483e87e9485add792661a3 to your computer and use it in GitHub Desktop.

Select an option

Save patrickwolf/9adc16c09c483e87e9485add792661a3 to your computer and use it in GitHub Desktop.
Using Shotgun/Shotgrid/Flow Action Menu Items (AMI) with Windmill
// there are multiple modes to add as header: //nobundling //native //npm //nodejs
// https://www.windmill.dev/docs/getting_started/scripts_quickstart/typescript#modes
// Using Shotgun/Shotgrid/Flow Action Menu Items (AMI) with Windmill
// This script forwards selected playlist IDs to the Yeti Export script.
// see: https://help.autodesk.com/view/SGSUB/ENU/?guid=SG_Administrator_ar_display_options_ar_user_menu_customization_html
// see: https://www.windmill.dev/docs/core_concepts/webhooks#custom-response-code
import * as wmill from "windmill-client"
export function preprocessor(
event:
| {
kind: "webhook";
body: any;
raw_string: string | null;
query: Record<string, string>;
headers: Record<string, string>;
}
| {
kind: "http";
body: any;
raw_string: string | null;
route: string;
path: string;
method: string;
params: Record<string, string>;
query: Record<string, string>;
headers: Record<string, string>;
}) {
return { "playlist_id": event["body"]["selected_ids"] }
}
export function main(playlist_id: string) {
// 1. This safely builds the URL and encodes the playlist_id correctly.
const params = new URLSearchParams({
playlist_id: playlist_id,
});
# Connect to your Windmill instance and replace WINDMILL_URL and SCRIPT path.
const targetUrl = `https://WINDMILL_URL/scripts/get/f/SCRIPT#${params.toString()}`;
return {
windmill_status_code: 302,
windmill_headers: {
"Location": targetUrl
},
windmill_body: "Redirecting to " + targetUrl
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment