Create dynamic objects with third-party data

Edited

Note: this article focuses on use cases involving dynamic objects and third-party data. If you're just getting started with dynamic objects, please review the general dynamic objects article first.

Overview

Dynamic objects allow you to transform text or URLs found in comments or messages into structured Orders, Shipments, Itineraries, Tasks etc. that are easy to access right from a conversation in Front.

That core functionality is available on the latest Growth plan and above, but customers on the Scale plan or above have the ability to populate a dynamic object's custom fields with data pulled from a third-party application.


When to use third-party data

A few examples where dynamic objects with third-party data are useful:

  • You want to see metadata about the objects you're dealing with, directly within Front. For example, the expected arrival date of a shipment, the completion status of a task, or the teammate that owns an itinerary could be synced onto the dynamic object and visible from Front without opening any external tools.

  • You want to use object metadata to power rules in Front. For example, routing conversations to a particular teammate depending on the owner of an associated load in your CRM.

  • You want to use object metadata to generate a useful target URL for your dynamic object. This is sometimes needed if the matched text or URL pattern is not enough to generate a useful target URL.

Dynamic objects make these use cases possible without writing any API code or hosting your own server, so long as you have access to an API that allows you to retrieve the dynamic object data you're looking for.


Configuration

Creating a Server

At a high level, dynamic objects with third-party data work by allowing you to connect Front with an external API to fetch relevant data for your dynamic objects. Using Front's Servers feature, no code or self-hosting is required.

Step 1

After you've created an app, select the Servers tab and then click Create server.

Step 2

Set the Origin field to the URL origin of your API. Don't worry about the particular API endpoint you'll be using yet — this field should just include the origin. For example, if the API endpoint you want to use is https://api.airtable.com/v0/{baseId}/{tableIdOrName}/{recordId}, the origin would be https://api.airtable.com

Step 3

Set the Authentication strategy used by your API. Today, API Key, Basic, Bearer, and OAuth2 authentication are supported. Depending on the strategy you select, you may be asked to provide additional configuration fields. Finally, click Create.

Step 4

After creating the Server, open it once more to set the Local credentials. These credentials should be the ones that allow you to connect to the third-party API. For example, if you selected API Key as the Authentication strategy in Step 3, you would save the particular token you use to access the API in Local credentials.

That's it! Your Server is now ready to make API requests. 

Using your Server to enrich dynamic object metadata

The following steps assume you already have a dynamic object set up. If you haven't, follow the instructions in the general dynamic objects article.

Step 1

On the dynamic object configuration page, click Create new under the Dynamic variables widget on the right sidebar. Select Start dynamic variable path and then Fetch from server.

Step 2

Use the dynamic variable to configure the API request to your server. The Fetch from server field should include the full address of the API endpoint you want to use, with any relevant variables filled in using variables from the original text pattern of your dynamic object.

For example, let's imagine we wanted to use Airtable's Get record endpoint: https://api.airtable.com/v0/{baseId}/{tableIdOrName}/{recordId}.

The base ID and table ID would be static for all of our dynamic objects, but the record ID would be pulled from the text pattern. Therefore, we'd configure Fetch from server as follows:

Note that "appti123" and "tbl23" are set statically, whereas the dynamic portion of the URL ("ALPHANUMERICS1") comes from the Letters or digits variable we created in the Text pattern field.

When a matching text pattern is identified by the dynamic object, Front will make a GET request to the URL specified in the Fetch from server field using the Local credentials you previously configured.

Depending on the response format of the API you are using, you may need to further extract particular elements of payload you receive from the API. In our example using Airtable, we'll receive a payload formatted like this:

{
  "createdTime": "2022-09-12T21:03:48.000Z",
  "fields": {
    "Expected arrival date": "4/13/2023",
    "Name": "Engine",
    "Team": "Red Bull"
  },
  "id": "rec123"
}

To extract the fields from the API response, we would add an Extract object property step and enter the name of the object property we're interested in ("fields").

Step 3

For each piece of metadata you want to add to your dynamic object, create a new dynamic variable to extract it from the variable we created for the API payload.

For example, to extract the "Expected arrival date" from our example above as its own variable, click Create new in the dynamic variables manager, then Start dynamic variable path and then Use result of variable. This will allow us to use the value of the value we extracted in Step 2. Next, we'll configure the arrival date variable as follows:

Note that we are using the "Fetch from Airtable" variable we created in Step 2, and extracting the "Expected arrival date" object property from it. We also added a step to "Parse as string" since we know that this property will be a string.

Step 4

Once you've set up your dynamic variables, they can be inserted into the dynamic object's preview properties using the "+" button.

In our example, since we extracted the “Arrival date” from the Airtable API, we can now insert it into a custom field our dynamic object:

Step 5

Finally, test your dynamic object using the previewer widget. If properly configured, you should see the data from your API enriched on the dynamic object:

Additional tutorials

Check out these step-by-step walkthroughs to continue exploring how to set up dynamic objects to retrieve data via an API:


Dynamic objects and rules

Once you've configured a dynamic object with third-party data that syncs metadata onto your objects, you can use that metadata in Smart Rules by creating conditions that check against the dynamic objects attached to the conversation.

For more details, check out our articles on Smart Rule variables and How to build a Smart Rule.


FAQ

When is metadata for a particular object updated/refreshed?

Metadata will be refreshed for a particular dynamic object each time it is encountered in a message or comment. For example, if you create a dynamic object that matches shipments with IDs like #123 and sync the order status from your CRM, the order status will only be refreshed when #123 is found in a message or comment. 

This means that it is possible for information to be out of date if data changes in your CRM for a particular record after a dynamic object is created for that record in Front. To guarantee that the information is up to date, you can manually send an email or post a comment with the reference ID.


Pricing

Dynamic objects connected to third-party data are available on the Scale plan or above.