DFO 3.0.0 - 12 Digizuite integration

Digizuite DAM integration service provides an API where integration endpoints can register for notifications regarding asset and metadata changes. We have made it easy to setup the connection between Optimizely and Digizuite. All you have to do is to add some configuration in the web.config - and your Optimizely instance will receive notifications from Digizuite whenever an asset changes.

In Optimizely we have created a new controller, which is located at the following route [siteUrl]/episerver/digizuite/DigizuiteWebhook/Update. This is the endpoint that receives notifications from Digizuite. An important thing to note here is, that the endpoint should be reachable by the Digizuite server. Otherwise, the notifications won't be sent. This is usually the case for developers on local environments.

letā€™s talk about what the controller does when it receives a notification. The data coming from Digizuite will be serialized in to an object of this type:

public class UpdateNotification { public int ChangeType { get; set; } public ChangeData Data { get; set; } } public class ChangeData { public int ItemId { get; set; } public int BaseId { get; set; } }

The property ChangeType indicates whether it's an AssetChanged, MetafieldChanged, ComboValueChanged or a TreeValueChanged. If it's an AssetChanged we do the following:

  1. Delete blobs for the relevant asset, based on the asset ID.

  2. Delete database entries for the relevant asset, based on the asset ID.

The last thing we do, is to raise an Episerver event with the UpdateNotification object.

_eventRegistry.Get(GlobalConstants.ContentEventRegistry.DigizuiteAssetChangeEventId).RaiseAsync( GlobalConstants.ContentEventRegistry.DigizuiteAssetChangeRaiserId, updateNotification, EventRaiseOption.RaiseBroadcast);

We're also listening for the event. For AssetChanged we clear the in-memory cache and if the RaiserId is coming from another instance (broadcast) and the configuration ā€œDeleteBlobā€ is true, then we delete the blobs and database entries for the relevant asset, based on the asset ID.

var digizuiteIntegrationEvent = _eventRegistry.Get(GlobalConstants.ContentEventRegistry.DigizuiteAssetChangeEventId); digizuiteIntegrationEvent.Raised += DigizuiteIntegrationEvent_Raised;

As a developer, you can also build your own logic around notifications from Digizuite. You can listen for the event by subscribing to the event, just like we do above.

1. Setup the endpoint

In your startup class where you have added the DAMIntegrationConfiguration we add a new property DigizuiteWebhookElement. Here you see an example:

The DigizuiteWebhookElement has 2 required properties SiteUrl and Guid.

The SiteUrl is the URL to your Optimizely site.

In Guid, you input a new guid. The guid is the unique identifier when we create the new endpoint i Digizuite DAM. The guid will also be send with the request from Digizuite as an header like this Authorization: dad72732-06f0-4468-a98a-1eb7449bf2fd. This is used to validate that the notifications come from the correct sender.

All properites for DigizuiteWebhookElement can be found here DFO 3.0.0 - 3 Setting up Optimizely.

The parameter deleteBlob indicates whether we should delete blobs of the asset. In a load balanced environment, where you have multiple instances in which each of the instances contains its own local blob storage, this should be set to true. If the blob storage is shared between instances, leave it as false.

Once the change has been made, reload the site. You will now see the following log statement, if it has been setup correctly and the endpoint has been created in Digizuite DAM.

2. Verify the connection

Once you have access to the Digizuite server. Open a browser from that server and access your Optimizely site. If you cannot access the site, Digizuite won't be able to send notifications to it.

If the server can access your site, the next test is to change an asset in the Digizuite DAM Center and verify that the notification has been sent to Optimizely.

  1. Go to the DAM Center and find an asset that is published to the Optimizely channel.

  2. Change some of the metadata, e.g. the title. The Digizuite DAM will notify all registered integration endpoints with the update.

  3. You should see the following log statement in the log file Digizuite.log. This indicates that Digizuite DAM has delivered the notification to the controller inside Optimizely.

    Ā 

  4. Lastly, verify that the changed metadata is the same as in Optimizely.

Ā