Open Navigation

Adstream

Adstream is a marketing automation software, used to help people master the art & science of digital marketing to engage customers and prospects.

Overview

With the Tray.io Adstream connector, you can use Adstream's powerful advertising platform to manage the creation, optimisation, storage and delivery of your content.

Authentication

IMPORTANT!: Before you start, please speak to your Adstream account manager in order to acquire an API application itself, if you do not already have one.

When using the Adstream connector, the first thing you will need to do is go to your Tray.io account page, and select the workflow you wish to work on. Once in the workflow dashboard itself, search and drag the Adstream connector from the connectors panel (on the left hand side) onto your workflow.

With the new Adstream connector step highlighted, in the properties panel on the right, click on 'New Authentication' which is located under the 'Settings' heading.

adstream-new-auth

This will result in a Tray.io authentication pop-up window. The first page will ask you to name your authentication appropriately, and state which type of authentication you wish to make ('Personal' or 'Organisational').

You will require the 'Client secret', 'Client key' and 'Domain' from your Adstream API application. Please speak with your account manager, or the API team, for an application.

As you can see, the next page asks you for your 'Environment', 'Client secret', 'Client key' and 'Domain'.

adstream-popups

Once you have clicked the 'Add authentication' button, go to back to your authentication field (within the workflow dashboard properties panel from earlier), and select the recently added authentication from the dropdown options now available.

Your connector authentication setup should now be complete.

Basic Operations List

Full list of operations can be found HERE

  • List Files
  • List Projects
  • Create Folder
  • Create Project
  • Upload asset to project
  • Upload asset to library

Note on Operations Usage

Create project directory

The 'Create project directory' operation requires a folder path in order to create your desired project/ folders. This is up to and including the root folder (i.e. the project) itself, where any part of the path that does not already exist, will be created.

For example, say you had the following directory structure: events/marketing/online/.

Assuming that the events project did not already exist, and therefore none of the subsidiary folders either - you would normally have to perform the following steps:

  1. Create a project named: events.
  2. Within the events project, create a folder named: marketing.
  3. Within the marketing folder, create a folder named: online.

This operation provides a convenient way to create any directory in just a single step. All that is needed is to use the delimiter specified in the 'Split by' field. It is set to double slashes // by default, but you can use any string you prefer PROVIDED that said string would never be part of any project or folder name.

With this in mind, the value that should be specified for 'Directory structure' should be: events//marketing//online:

adstream-create-project

Using the Raw HTTP Request ('Universal Operation')

As of v1.0, it is possible to effectively create your own operations.

This is a very powerful feature which you can put to use when there is an endpoint in Adstream which is not used by any of our operations.

To use this you will first of all need to research the endpoint in the Adstream API v2 Documentation, to find the exact format that Adstream will be expecting the endpoint to be passed in.

Note that you will only need to add the suffix to the endpoint, as the base URL will be automatically set (the base URL is picked up from the value you entered when you created your authentication).

The base URL for Adstream is: https://{your_adstream_domain}/api/v2.

For example, say that the 'List folders' operation did not exist in our Adstream connector, and you wanted to use this endpoint, you would use the Adstream API v2 Docs to find the equivalent, aka the 'Search for a folder' endpoint. Note that it is a GET request at the following URL:

adstream-get-request-folders

So if you know what your 'List folders' endpoint should be, and what your domain is, you can get the details you need with the following settings:

Method: GET

Endpoint: /folders

Domain: example.adstream.com

Final outcome being: https://example.adstream.com/api/v2/folders

adstream-raw-http

This setup should now return a listing of all folders, as requested.

Example Usage

TRAY POTENTIAL: Tray.io is extremely flexible. By design there is no fixed way of working with it - you can pull whatever data you need from other services and work with it using our core and helper connectors. This demo which follows shows only one possible way of working with Tray.io and this connector. Once you've finished working through this example please see our Introduction to working with data and jsonpaths page and Data Guide for more details.

Below is an example showcasing how you could use the 'Upload asset to project' operation, to upload a new file to your project as a new asset. Any connector step that returns a File object can be used but in this example, we will be using Google Drive.

AUTH NOTE: You will need a Google Drive Tray.io authentication set up in order to proceed with this demo. Please see the authentication section highlighted for more details.

The steps will be as follows:

  1. Setup a manual trigger and get a sample file from Google Drive.
  2. Download the file in question.
  3. Upload your asset to your Adstream project.

The final outcome should look like this:

adstream-complete-workflow

1 - Setup Trigger & Get File

Once you have clicked 'Create new workflow' on your main Tray.io dashboard (and named said new workflow), select the Manual trigger from the trigger options available:

adstream-manual-trigger

Once you have been redirected to the Tray.io workflow dashboard, from the connectors panel on the left, add a Google Drive connector to your second step. Make sure you have selected your Google Drive authentication and set the operation to 'List files'.

For the purpose of this example, on Google Drive there is a folder called fileupload that contains a file called example.png.

This example is aiming to locate a specific file, to the filter fields are populated as follows: 'Filter by Folder' is set to fileupload, and 'Filter by name' to example.png.

adstream-example-find-file

2 - Retrieve File

From the connectors panel on the left, add another Google Drive as the third step. Set the operation to 'Download file'.

Note that the 'File ID' is a mandatory field, and in this case returned by the previous step.

To specify the data you want to reference, use the mapping icon available next to the 'File ID' property, in conjunction with the connector-snake. Hover over your previous Google Drive step to see the list of options available. Select the option id when is appears.

Your input field should automatically pre-populate for you with a jsonpath, similar to the following: $.steps.drive-1.files[0].id.

For better clarification of the pathways you have available, use the Debug panel.

JSONPATHS: For more information on what jsonpaths are and how to use jsonpaths with Tray.io, please see our Intro page and Data Guide for more details. CONNECTOR-SNAKE: The simplest and easiest way to generate your jsonpaths is to use our feature called the Connector-snake. Please see the main page for more details.

The Google Drive step labelled 'Download File' is now configured to download the File located by the previous Google Drive step (labelled 'Find File').

adstream-example-download-file

3 - Upload Assest

From the connectors panel on the left, drag the Adstream connector into your workflow as your fourth and final step. Set the operation to 'Upload asset to project'.

Provided your authentication is setup correctly, you will be able to choose from a dropdown list of options for your 'Folder ID' field. Our example is set to 'UploadDir'.

The 'Filename' field can be set by once again using the connector-snake method. Hover over your previous Google Drive connector (aka the 'Download File' step) to see the list of options available. Select the option name when is appears. Do the same again for your 'File' field, this time selecting file. You should notice that the list of options changes depending on the field you are working with.

As this example is adding a new asset to the Adstream project folder, the metadata must be provided.

Under the field name 'New asset or revision?' select 'New asset metadata' from the dropdown options. Under the 'Meta' field name, click on the greyed out button 'Add property to Meta'. In the new popup that appears, set your new property name to common.

adstream-new-property

Change the property type selector to object, and click on the second grey button, 'Add property to common'. Enter name as the name of the second new property. Finally enter uploaded example as the value of the 'name' property itself.

Your completed step should look similar to below:

adstream-upload-asset

Now that all the steps have been added and configured, the workflow is ready to run.

Log into your Adstream dashboard, and navigate to the 'UploadDir' folder (or what is appropriate to your project). The new asset named 'uploaded example' has been uploaded there.

adstream-example-result

BEST PRACTICES: Whenever you do decide to use create your own workflow, please make sure you take a look at our Managing data best practices guide.

Was this article helpful?
Yes
No