Working with Files and Media

Application vs. Journey Assets

Airkit handles files and media in two ways on that is part of the application and shared across all users and the other is stored within a particular user's journey.

App Assets

App Assets are files & media that are included in the application itself and can be referenced through the Studio when designing an experience.ย Examples Include:

  1. Images in a web experience (PNG, JPG, etc.)
  2. Documents to download (PDFs, ZIP etc.)
  3. Or other media such as videos (MP4)

These assets need to be included in your Media Library and are made available through special URLs that resolve securely to a user through your custom domain and quickly as through the Airkit CDN.

2021-03-11_12-30-52__1_.png

ย 

Journey Assets

Journey Assets are files that are associated with a specific user's journey within Airkit and can be stored within variables and used within data operations. Some common examples include:

  1. Photos captured from a customers mobile device
  2. Files uploaded from a customer
  3. Customer signatures (PNG)
  4. Generated PDF files (Form fills, merged PDFs or custom generated)

Because Journey Assets are stored in variables the scope of how long they are available is determined by whether the Journey is active or expired, please see Journey State for more information.

ย 

Working with Assets in Variables

The Asset data type of a variable allows you to work with files and media within a journey using Airscript and within Data Flows.

asset_type.gif

Real-World Use Cases

Some examples of when you might use a variable with the Asset data type to receive or handle a file

ย 

Embedding Assets within Your Application

Using Media Library you can upload assets to be included and referenced in your application

Untitled.gif

ย 

Once a file has been uploaded into your Media Library you now have an Asset URI to use to reference the file while building your app.

ย 

Inserting Images using the Image Web Control

inserimage.gif

Why Does Airkit Use Special URLs for Assets?

You may notice that the way Airkit refers to files is not a typical URL and isn't able to be retrieved outside of the Airkit platform.ย  There are two primary reasons for using a specific URI

  • Security - these Asset URIs can only be accessed in the context of an Airkit operation such as within a journey of a user and are dynamically exchanged for temporary URL
  • Version Control - we want to make sure that files are tracked across versions of applications easily and caching issues do not arise

What are the components of an Asset URI?

asset://[Access Scope]:[Organization UUID]/[Application UUID]:[File UUID]:[Version Number]

  • Access Scope: Global or user specific
  • Organization UUID: Your Organizations ID
  • Application UUID: The specific branch of the application that is serving the asset.ย  This is used for version control so that asset links will still function for journeys that started on an older branch of your application
  • File UUID: Uniquely represents the file within your application's Media Library
  • Version Number: An auto-incrementing version number of an asset

ย 

Working with Assets in Data Operations

A quick walk through of some Data Operations that work with Assets

ย 

There are quite a few Data Operation that either produce files or consume files to perform their actions and all of these functions leverage the Asset variable type to provide or pass around references to the underlying files.ย  For example:

ย 

Operations that Create or Consume Files

  • Create File produces any file type and inserts content such as TXT, JSON, XML, CSV, TSV
  • Fill PDF Form takes a blank PDF template and merges values into form field to produce a filled PDF
  • HTML to PDF creates a custom PDF using HTML for layout, styling and allowing full control over data and dynamic content including inserting images, CSS, footers/headers, page breaks and more
  • Merge PDF provides an operation to combine the pages of multiple PDF files into one PDF
  • Create ZIP File provides an operation to combine and compress multiple files into a single ZIP file

Operations that Transmit Files Externally

  • Send Email allows to attach one or more files to an outbound email originated from Airkit
  • SFTP allows sending a file securely over FTP to remote server

Operations that Support Asset Operations

  • Fetch Asset Details given an Asset URI looks up file details such as (name, type, size) and provides a temporary URL to download the underlying file
  • Delete Assets removes the underlying file(s) from the server for an asset