Resource Library

Coast's Resource Library enables you to define globally-accessible API requests or custom scripts within a demo. Unlike Coast's standard Request tab, these resources are, by default, not tied to a specific point in the demo, making them global functions that have configurable trigger conditions.

To add to the Resource Library, navigate to the Config tab, found at the top bar of the builder.

There are 4 types of resources that can be added to the Resource Library: Tasks, Requests, Power Ups and Listeners

Since these Tasks or Requests are not tied to a specific point in the demo, we will need to define a condition for when they should execute. Tasks or Requests can be triggered in 2 ways:

  1. By satisfying the condition defined directly in the Resource Library

Make use of the visual Conditions editor to define the condition for which this resource should execute.

Run on Load: Execute this task/request anytime a demo link is loaded

Run on Create: Execute this request when a new demo is created

  1. By assigning the action of a clickable block to execute this Resource.

Tasks

Tasks enable you write custom scripts to update Local Database values, behind the scenes, without ever surfacing this logic to a demo viewer. Any value that is returned from the Task code editor will be stored in the Local Database, under the key specified in the Write Database Path field.

Reference local database values within the task script editor via this.db.PATH_TO_VARIABLE

In this example, the value at the key formatCurr will be updated to a formatted version of the value stored at currAmount when the demo arrives at the Step 2: Design tab and the value stored at currAmount is not null.

Requests

Requests allow you to trigger cURL requests, behind the scenes, without ever surfacing this logic to a demo viewer. Any value that is returned from the Request will be stored in the Local Database, under the key specified in the Write Database Path field.

In this example above, Coast will trigger a GET request to https://example.api.com/testing, once the database key purpleDemo Exists in the local database. The data contained in the response object will be stored in the local database, under the key baseBallFountain.

Power Ups

Break the 4th wall and interact with prospects in real-time by firing a live email directly from Coast. Make use of {{ }} notation to set a dynamic recipient email or subject, and then style your email using HTML. Reference Local Database values within the HTML editor using {{ }} notation as well.

Listeners

Listeners will create a unique URL for every demo session at the path indicated above. Make use of this unique URL to subscribe to webhook events, which will save the streamed payloads at the Write Database Path defined in the Listener.

In the example above, you can now dynamically subscribe to webhook events using a unique url, which is stored at listenerUrl . Any data that is streamed to that webhook will be stored in the Local Database under incomingData