Mini-Flow : Normalize Any Base64 String Before Using It in Your Zenphi Flows
Hey Zenphi Community! 👋
Have you ever received a Base64 string from an API, Gmail attachment, webhook, AI response, or another external system, only to find that it doesn't work in the next action?
This is more common than you might think.
Depending on the source, Base64 strings can come in many different formats. Some use the Base64URL variant (- and _ instead of + and /), some are missing the required padding (=), some include line breaks or spaces, others are wrapped inside quotes, and sometimes the value even comes as a full Data URI such as:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...Although all of these represent the same binary data, many services and actions expect a standard RFC 4648 Base64 string. When they receive anything else, decoding can fail unexpectedly.
To make this easier, we've created a reusable Base64 Normalizer Mini-Flow that accepts almost any common Base64 format and converts it into a clean, standardized Base64 string ready for the rest of your workflow.
🛠️ What This Mini-Flow Does
This Mini-Flow automatically:
✅ Detects and extracts Base64 from Data URIs
✅ Converts Base64URL (-, _) into standard Base64 (+, /)
✅ Restores missing padding (=)
✅ Removes unnecessary spaces, tabs, and line breaks
✅ Removes surrounding quotes
✅ Decodes URL-encoded Base64 values when necessary
✅ Validates the Base64 format before returning it
✅ Returns useful metadata such as:
Normalized Base64
MIME Type (when available)
Validation Status
Error Message (if invalid)
💡 Perfect For
This Mini-Flow is especially useful when working with:
Gmail attachments
HTTP Request / Webhook payloads
AI-generated Base64 content
Google Drive APIs
Microsoft Graph APIs
Image processing workflows
PDF generation
File uploads
Any third-party API that returns Base64
Getting this running in your workspace takes less than a minute.
Note: Although this is shared as a Mini-Flow, once imported into your workspace it is designed to be reused as a Subflow. This allows you to centralize your Base64 normalization logic and call it from any workflow using a single Run Subflow action.
Download & Import
Normalize Base64_1783709849737.json
Download the attached Mini-Flow and import it into your Zenphi workspace.Add a Run Subflow Action
In any workflow where you need to normalize a Base64 string, add a Run Subflow action.Select the Base64 Normalizer Subflow
Configure the action to execute the imported Base64 Normalizer Subflow.Pass the Input
Map your incoming Base64 string (from Gmail, HTTP Request, AI, Google Drive, Microsoft Graph, or any other source) to the Subflow's Base64 Input parameter.Use the Output
The Subflow returns a single object with the following properties:
{ "NormalizedBase64": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO7Z0i8AAAAASUVORK5CYII=", "MimeType": "image/png", "IsValid": true, "ErrorMessage": "" }Use the NormalizedBase64 property in your main flow actions instead of the original Base64 string. You can also use IsValid to verify the input before processing, MimeType when the source provides it, and ErrorMessage for logging or troubleshooting invalid inputs.
That's it! You now have a reusable Base64 normalization utility that can be called from any workflow with a single Run Subflow action, ensuring all of your automations work with a clean, standardized Base64 string regardless of how it was originally formatted.