Build your first flow in MediaFlows

Last updated: Dec-15-2022

Once you have signed up to MediaFlows and created a project you can proceed to create your first flow.

On this page:

Video walkthrough

This video walks you through creating a flow that runs automatically when a video is uploaded to Cloudinary using a specific upload preset. A square thumbnail of the video is uploaded to a folder called video_thumbnails in your Media Library.

Follow the steps in this video to create the flow:

Tip
If you want to see the whole flow, already created, you can open the flow in MediaFlows and import it to one of your own projects.

To create this flow:

Jump to this spot in the video  0:05 1. In your project click Create New Flow.
Jump to this spot in the video  0:09 2. Select Start from scratch to open a blank canvas.
Jump to this spot in the video  0:18 3. Rename the flow from New Flow to Video Thumbnails in the top left of the canvas.
Jump to this spot in the video  0:24 4. From the Media Blocks panel on the left, select and drag a Catch Webhook block onto the canvas.
Jump to this spot in the video  0:29 5. Double-click the Catch Webhook block, then click Create Upload Preset. If you go to your Cloudinary Console, navigate to Settings > Upload and scroll down to Upload presets you'll see a new upload preset where Notification URL is set to the webhook URL in the block.

Automatically created upload preset
Whenever an upload to your Cloudinary product environment is made using this upload preset, a notification will be sent to this URL, which will trigger the flow.
Jump to this spot in the video  0:54 6. Click Save to close the block.
Jump to this spot in the video  0:56 7. From the Media Blocks panel, select and drag a Resize Video block onto the canvas, to the right of the Catch Webhook block.
Jump to this spot in the video  1:04 8. Join the two blocks together by selecting the blue output of the Catch Webhook block and dragging it to the input of the Resize Video block.
Jump to this spot in the video  1:12 9. Double-click the Resize Video block, enter 200 in the Width and Height fields, and clear the Aspect Ratio field. Leave the Crop field as Fill and the Gravity field as Automatic - these settings ensure the most interesting parts of the video are kept in the crop. This block does not resize the newly uploaded video, but it creates an eager transformation of the video.
Jump to this spot in the video  1:38 10. Click Save to close the block.
Jump to this spot in the video  1:43 11. From the Media Blocks panel, select and drag an Upload Media block onto the canvas, to the right of the Resize Video block.
Jump to this spot in the video  1:50 12. Join the two blocks together by selecting the blue output of the Resize Video block and dragging it to the input of the Upload Media block.
Jump to this spot in the video  1:59 13. At this stage you need to push media into the flow, to populate the dynamic values in the Upload Media block. Do this by uploading a video to your Cloudinary product environment, using the upload preset that was created, MediaFlows_Video Thumbnails_Catch Webhook. In the video this is done using the Upload Widget in the Media Library, but not all product environments have the option to select the upload preset from here, so if you don't, you could, for example, use the Cloudinary CLI:
Copy to clipboard
cld uploader upload video.mp4 upload_preset="MediaFlows_Video Thumbnails_Catch Webhook"
Jump to this spot in the video  2:25 14. Double-click the Upload Media block to edit the settings.
Jump to this spot in the video  2:33 15. At the bottom of the block select the curly braces icon { } (dynamic value selection). From the drop down, select [Resize Video].eager[0].secure_url. If this option is not there, you may need to wait a few moments. Paste the copied value into the Media URL field. This provides the URL of the eager transformation performed on the video in the Resize Video block.
Jump to this spot in the video  2:45 16. Select Video for the Asset Type.
Jump to this spot in the video  2:50 17. Set the Optional Parameters to:
Copy to clipboard
{
"folder": "video_thumbnails"
}
Jump to this spot in the video  3:00 18. Click Save to close the block. This block is now set to upload the resized video into the video_thumbnails folder.

And that's it! You can now test your flow by uploading a video to your Cloudinary product environment, using your upload preset.

For example, using the Cloudinary CLI:

Copy to clipboard
cld uploader upload video.mp4 upload_preset="MediaFlows_Video Thumbnails_Catch Webhook"

In your Media Library, you'll see the original uploaded video in the root of your library, and the 200x200 pixel video thumbnail of the video in the video_thumbnails folder.

✔️ Feedback sent!

Rate this page: