How Do I Implement a Workflow From My Code?

So you’ve configured a Workflow that meets all of your business requirements: you’re scanning all uploads to your website for viruses and malware, making sure the uploads do not contain any NSFW or copyrighted content, and — if the upload is an image — optimizing it for delivery. Now what? How do we invoke this workflow?

There are two places developers need to wire up this workflow: