Your app can contain static assets for various purposes including images and documents. When installed, an app can reference metadata to retrieve a CDN URL to a named asset. One use case, for example, is to provide a logo for your app to be displayed in the Swell dashboard and elsewhere.

Assets are placed in the assets/ directory of your App root. The maximum file size for an asset is currently 8MB.

Here’s an example of how to reference an asset URL from a notification template:

notifications/welcome/tpl
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>{{ subject }}</title>
  </head>
  <body>
    <h1>Welcome to {{ store.name }}</h1>
    <img src="{{ assets.welcome_png.url }}" />
    ...
  </body>
</html>

In this example, you can see that we have access to special property assets which contain an index of all the assets in your app. The naming convention of indexes in this object is to underscore file names. For example, in this case, assets/welcome.png becomes asset.welcome_png.

The schema for an asset in this context is the same as a :files record in Swell.