Block reference

Last updated: May-11-2023

As explained in Learn about blocks, flows are composed of a set of blocks that you connect together, creating step-by-step actions to execute. Each block performs a specific function. Blocks are grouped into different categories to make them more accessible:

Triggers

Triggers are special blocks that are used to start the flow execution. For example, use the Catch Webhook block to trigger the flow every time a webhook is sent to a specific URL or use the Scheduler block to trigger the flow on a predefined schedule.

Tip
Every flow starts with a trigger block.

Catch Webhook

Webhooks are a simple way for applications to send messages to one another. This is how, for example, your Shopify store can send a message to Slack to notify you of a new order.

Use this block to trigger a flow from any application.

The block is configured with a specific web address (also known as a webhook URL). When the block receives an HTTP request at the webhook URL, it triggers the flow. The triggered flow can then perform a series of actions, such as uploading an image, updating metadata, or calling an API.

Parameters included in the HTTP request are made available to the rest of the flow for use in various blocks.

Important
The webhook is not automatically verified. Please take all possible precautions to ensure that your data remains secure and protected. This includes verifying the source of the webhook whenever possible, testing the flow in a development or staging environment, and monitoring its activity closely.

In the example below, every message received by the flow is automatically sent using SendGrid. If you configure Cloudinary to trigger this flow, every event in Cloudinary will be sent using SendGrid to any email you choose.

Webhook example

To configure your Cloudinary product environment to trigger a flow:

  1. Double-click the Catch Webhook block to open its settings page:

    Catch Webhook properties
  2. Use the Copy button to copy the webhook URL to your clipboard.
  3. Navigate to the Upload Settings page in your Cloudinary Console.
  4. Paste the copied URL in the Notification URL field and click the Save button at the bottom of the page.

Scheduler

Use this block for recurring flows. Trigger an action every day of the month, every day of the week or every single day. This is similar to a crontab, cronjob or cron.

See crontab.guru to easily create a cron schedule expression.

Notes
  • The timezone used is UTC.
  • The minimum scheduling interval is one hour.

DAM App

Use this block to trigger a flow from your Cloudinary Media Library. This is done using Cloudinary's Apps for DAM.

Double click the DAM App block to configure its appearance in the DAM App.

You can modify the title, the description, and its cover image.

DAM App block

To run the flow, you need to enable the MediaFlows DAM app in your Cloudinary product environment. Contact support if you don't see the MediaFlows DAM App listed in your App Marketplace.

MediaFlows DAM app

Once the app is enabled, select the media you want to send to the flow and select Run MediaFlows from the kebab menu:

Select MediaFlows DAM app

The MediaFlows DAM App will present the list of flows in your account that have DAM App as a trigger block. Click the flow that you want to trigger.

Select flow to run

Flow Logic

These blocks can be used by any flow to implement logical flow functionality.

Condition

Use this block to determine how to proceed based on a condition.

This is the only block that has two happy paths (two blue dots).

  • The block connected to the upper happy path is executed if the condition is met (returns true).
  • The block connected to the lower happy path is executed if the condition is not met (returns false).

For example, the filter could test if the asset is an image, and if it is, process the image, otherwise send an email:

Example of using the filter block

Note
In the Condition block settings, you must set the Key field to a dynamic value.

Apply On Each

Use this block to run the next connected block on each item in a list.

In each of the next connected blocks, you can refer to the relevant item and index using the dynamic values menu.

For example, you could split a string and add all items as tags to an asset. Example of using the apply on each block

Cloudinary APIs

These blocks interact with Cloudinary APIs.

Account Usage

Use the block to get information about your account usage. This block calls the usage method of the Admin API.

For example, you could schedule a daily email to be sent if a specific quota is exceeded in your usage:

Account Usage example

Rename Media

Use this block to rename an asset in Cloudinary or move it to a different folder. This block calls the rename method of the Upload API.

For example, when a media is uploaded to Cloudinary, if its size is larger than 3MB, move the asset to the_/large_files_ folder:

Rename Media example

Upload Media

Use this block to upload content from an FTP, HTTP, or HTTPS URL into your Cloudinary product environment.

You can include optional upload parameters in the Optional Parameters (Advanced) section using JSON format.

Optional upload parameter

Once an asset is uploaded, you'll receive many fields you can use in subsequent blocks such as the ones shown in this sample response.

For example, a when media is uploaded to an S3 bucket, upload it to Cloudinary and add the tag from_s3, so it will be searchable in your Media Library:

Upload media example

Process Media

Use this block to apply actions on assets in Cloudinary. For example, to convert a video to multiple formats up front, so the different formats of the video will not need to be generated on the fly when first accessed by users. This block calls the explicit method of the Upload API.

Read the documentation on the explicit method to get ideas on what you can achieve with this block. You can include optional parameters in the Optional Parameters (Advanced) section using JSON format.

For example, when media is uploaded to Cloudinary, if the media is a video, apply video optimizations. Otherwise, apply image optimizations:

Process Media example

Get Asset Information

Use this block to get information on a media in Cloudinary such as the width, height, version, secure URL, and more. This block calls the explicit method of the Upload API.

For example, when a tag is added to an asset in Cloudinary, get the secure URL of the asset and send it to Akeneo.

Get Asset Info example

Get Tags

Use this block to get the tags of a media asset in Cloudinary. This block calls the resources method of the Admin API.

Update Tags

Use this block to update tags on media assets in Cloudinary. This block calls the tags method of the Upload API.

Get Contextual Metadata

Use this block to get the value of a contextual metadata field of a media asset in Cloudinary. This block calls the resource method of the Admin API.

Update Contextual Metadata

Use this block to update contextual metadata on media assets in Cloudinary. This block calls the context method of the Upload API.

Get Structured Metadata

Use this block to get the value of a structured metadata field of a media asset in Cloudinary. This block calls the resource method of the Admin API.

Update Structured Metadata

Use this block to update structured metadata on media asset in Cloudinary. This block calls the metadata method of the Upload API.

Create Structured Metadata

Use this block to create a new structured metadata on media asset in Cloudinary. This block calls the metadata_fields method of the Admin API.

Cloudinary add-ons

In order to use a block that’s associated with a Cloudinary add-on, you need to register for the add-on first.

Cloudinary Background Removal

Use this block to automatically and accurately remove the background of an image.

This block uses the Cloudinary AI Background Removal add-on. Note: you need to register to this add-on in order to use this block.

Amazon Image Moderation

Use this block to automatically and accurately moderate your images.

This block uses the Amazon Rekognition AI Moderation add-on. Note: you need to register to this add-on in order to use this block.

Google Image Tagging

Use this block to automatically add tags to an image.

This block uses the Google Auto Tagging add-on. Note: you need to register to this add-on in order to use this block.

Google Video Tagging

Use this block to automatically add tags to a video.

This block uses the Google Automatic Video Tagging add-on. Note: you need to register to this add-on in order to use this block.

For example, when the flow is executed using the DAM App, if the selected asset is an image, automatically add tags to the image using the Google Image Tagging block. If the selected asset is a video, automatically add tags to the video using the Google Video Tagging block.

Google Image Tagging example

Integrations

Get Tokens From Akeneo

Use this block to retrieve Akeneo tokens. Place this block prior to any other Akeneo related blocks, to allow them to use the retrieved tokens and access Akeneo APIs. Note: you need to register to Akeneo in order to use this block.

The connection information required below can be copied from the Akeneo Connections page.

Akeneo - Create Asset

Use this block to create an asset in Akeneo's Asset Manager.

Use Akeneo’s Product Link Rule to automatically link the created Akeneo asset to a product.

Akeneo - Delete Asset

Use this block to delete an asset from Akeneo's Asset Manager.

Notifications

Send Message with Twilio

Use this block to send an SMS or a WhatsApp message using Twilio.

Note: you need to register to Twilio in order to use this block. The account information required below can be copied from copy the Twilio console.

Send Email Using SendGrid

Use this block to send an email using SendGrid.

Note: you need to register to SendGrid and have a Dynamic Template available in order to use this block.

Developer Tools

Send HTTP Request

Use this block to communicate with other services and APIs. For example, send the media output to a marketing automation system.

Search and Replace

Use this block to replace all occurrences of a specified string or regular expression with a specified replacement string.

Join Strings

Use this block to concatenate two strings with an optional separator.

Split String

Use this block to split a string using a predefined separator.

Message

Use this block to display a message in the Execution logs. It's good practice to use this block when creating flows for debug purposes, and for displaying messages in the execution logs and history logs.

Message Example

MediaFlows Function

Use this block to add custom logic to your flows. You can use this block to transform media, compute data, or even perform simple operations within flows that you might otherwise need to write server-side code for.

Important
The MediaFlows Function block is not available by default to all accounts. Contact support to enable it.

MediaFlows functions support Javascript (ES7).

MediaFlows function parameters

Add your custom code inside the MediaFlows function.

Function parameters

Parameter Description
event Contains flow instance IDs, and all the data from blocks.
cloudinary A ready-to-use Cloudinary object, which contains the OAuth token.
callback To return the output or an error.

The event object

The event object contains all the data from the current flow run instance and data from all previous blocks.

This is an example of an event object structure and data:

The cloudinary object

The cloudinary object is an instance of Cloudinary’s Node SDK.

Use it to perform any API request to the Cloudinary APIs. See the Node SDK documentation.

Here is an example of a function that calls the explicit method of the Upload API:

The callback object

Any data that is returned with the callback from this function can then be accessed by the next blocks in the flow.

Here is an example of a function that uses the callback function to pass the response of an API call to the next block:

Using dynamic parameters

As with any other block, MediaFlows dynamic parameters can be accessed from the {} button in the bottom left corner of the block. See Block parameters to learn more.

Here's an example of a function that gets a parameter from the previous block:

Wrapping it all together

Here's an example of a MediaFlows function that accesses parameters from the previous block, calls the explicit method of the Upload API, and passes the result to the next block:

✔️ Feedback sent!

Rate this page: