1. Guides
  2. Attachments

Guides

Attachments

Understanding File UUIDs and Used them in attachments

In order to attach files to any sort of notification, you need to understand the JSON data structure of files uploaded to a stub and then how this is used in the notification to attach a file.

The notification library has examples of how to reference an uploaded files data and its UUID.

The Files UUID

The file's UUID is its unique identifier in Stubber's file server.

This can be found in different places:

File Section
Navigate to the Files section in the stub and locate the file you would like to attach. Right Click on the little download icon and click Copy Link Address R-Click files Link Paste the url into a text editor of your choice. The File's unique UUID is the text that appears after the last / UUID From File URL

Stub Data

  • Open up the Data section on the stub.
  • Find the file field name the file was upload to.
  • Click on the + to the left of the field name
  • Click on the + to the left of the first array element
  • The UUID in the value of fileuuid as below. UUID From Data Section

Uploaded File JSON Structure

In the Screen Shot above, you will notice the uploaded file's data in the stub has a specific structure.

Lets take a look at this structure a little closer:

loading...

The field name this file was uploaded into is files. As you can see, files is an array of objects. Each file that was uploaded into the field is an object in the array.

The file's uuid is stored inside each object.

Referring to the File

When referring to the file, some notifications require just the UUID and others use the entire file's object.

Using only File UUID

You would refer to the files uuid as : ~~stub.data.files[0].fileuuid

This provides only with uuid.

Using the File's object

You would refer to the file's object as : ~~stub.data.files[0]

This will preserve the entire files JSON structure with all its key : value pairs.

Using in Notifications

Email

Please see this topic for sending an attachment via email. Attaching files to Email

WhatsApp

Please see this topic for sending an attachment via WhatsApp. Send a file via Whatsapp