How to
Upload from Base64 node

Jermaine Issa
Jermaine Issa
  • Updated

The Upload from Base64 action is an Early Access feature. Contact your Account Executive to have it enabled for your Pendula tenant.

What is Upload from Base64?

The Upload from Base64 action processes a Base64 array and makes it available as a formatted usable file to reference in your flow. This is achieved by providing the base64 code, file name (including the extension type), and the mimeType. The mimeType is what informs the action of the type of file it should create.

Node configuration

Sending base64 files to the flow

Webhook trigger: array schema

The input for this array will need to be included as a payload in the Merge fields tab of the Webhook trigger at the start of the flow. 

When structuring your trigger payload, you must include the file array of Base64 code, the name of the file (including the extension), and mimeType. 

You can nest multiple files in the payload array under a single merge field that can be referenced throughout the flow. For example, when this merge field is referenced in the email attachment node, it will send both attachments. In the following example, we are creating a calendar invite attachment and a PDF for an email:

file: The content of the file encoded in Base64
name: the name of the file including the extension
mimeType: the mime type of the file.


Example JSON payload

{
  "attachments": [
    {
      "file": "base64 code goes here",
      "name": "file name including extension.ics",
      "mimeType": "text/calendar"
    },
    {
      "file": "base64 code goes here",
      "name": "file name including extension.pdf",
      "mimeType": "application/pdf"
    }
  ]
}
  • Extension File Type Description MIME Type
    .txt Plain text text/plain
    .html HTML document text/html
    .jpg/.jpeg JPEG image image/jpeg
    .png PNG image image/png
    .gif GIF image image/gif
    .webm WebM video video/webm
    .mp4 MPEG-4 video video/mp4
    .mpeg MPEG video video/mpeg
    .pdf PDF application/pdf
    .doc Microsoft Word document application/msword
    .docx Word Open XML document application/vnd.openxmlformats-officedocument.wordprocessingml.document
    .xls Microsoft Excel spreadsheet application/vnd.ms-excel
    .xlsx Excel Open XML spreadsheet application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

For details of supported file types and other useful information about working with attachments in Pendula please see: Outbound email node (with attachments)


Settings

In the Upload from Base64 node, the settings tab contains a single input field. The input field requires an array matching the schema above to be supplied.

  1. On the merge fields tab, select the Webhook trigger, then the tab containing the array. In this example, the "attachments"
  2. Click the file to copy the merge field to your clipboard

 

  1. Paste this into the “Search merge fields…” bar above. The merge field will be similar to {{inboundWebhookTrigger_1.attachments.[0].file}}. Select and delete the index and property — make sure to select from the full-stop onwards.
     

 

  1. After deleting the index and property, the text should look similar to {{inboundWebhookTrigger_1.attachments}}. Select it and copy it to your clipboard. 

 

  1. Select the Settings tab and paste this text into the input field. It will automatically format into a green chip.

Outcomes

Outcome paths can be configured if you wish for the action to perform a different next step based on whether it was successful or not. The following outcomes are available for this node:

Success: the action was successful in uploading the file/s

Success: No Files: an empty array was supplied and no files were included. This allows a single flow to handle different use cases where some recipients may receive attachments while others don't.

Failure: the action was unable to upload the files. This may be due to a misconfiguration or the supplied data not meeting the requirements.

 


Use case: sending the attachments as emails in the flow

The file/s are now available to include in a subsequent Outbound Email node. 

In the Attachments tab of the Outbound Email node, use the Search attachment fields lookup to select the attachments from the previous node.

 


Related to